Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Ok, I've been asking various questions and getting some good answers, but I think I need to rethink my method, so I'll describe the problem.

I have a player who has a big blue box in front of him. This box shows which KActors will be pushed when he pulls the trigger:

enter image description here

Currently, the blue box spawns a descendant of Actor which checks collision to see which KActors are touching it:

foreach Owner.TouchingActors(class'DynamicSMActor', DynamicActorItt)
{
      // do stuff
}

The problem is, if you check for touching between Actors and KActors, it looks like it does a plain axis-aligned bounding-box collision. The power will push the box on the lower right, when it's clear it's not touching the blue box.

How should I do this properly? I just need a way to find out which KActors are touching that area, on a poly-by-poly level. These collisions are only done with rectangular boxes and simple sphere collision; we are aware of the potential for performance issues with complex objects and poly-collision.

I've tried making the collision checker a KActor, but it doesn't report any TouchingActors.

This issue is causing us trouble in a lot of other places as well. So solving this problem is a core issue in our game.

share|improve this question
1  
I've not worked with UDK, but is there not a way to use non-axis aligned bounding box? –  Byte56 Dec 12 '12 at 17:35
    
bCollideComplex is supposed to do that, but setting it on my actors doesn't change anything. –  Almo Dec 12 '12 at 18:49
    
Maybe this thread is useful? forums.epicgames.com/archive/index.php/t-616506.html –  Byte56 Dec 12 '12 at 19:09
    
I don't think so, because we're not using cooked assets. –  Almo Dec 12 '12 at 19:39
add comment

2 Answers

up vote 2 down vote accepted

Current solution:

local Vector ImpulseToApply, PointA, PointB;
local GJKResult theResult;
local DynamicSMActor TempActor;

foreach Owner.TouchingActors(class'DynamicSMActor', TempActor)
{
    theResult = 
    QuadForceImpulseActor(Owner).CollisionComponent.ClosestPointOnComponentToComponent(
        TempActor.CollisionComponent,
        PointA,
        PointB);
    if(theResult != GJK_Fail && VSizeSq(PointA - PointB) < 0.01)
    // if(theResult == GJK_Intersect) // TODO: GJK_Intersect is never returned, for some reason
    {
        // handle collision
    }
}

The ClosestPointOnComponentToComponent function returns GJK_NonIntersecting regardless of whether or not the components intersect. However, the two closest points returned overlap when they intersect. I think this is a bug in the function. Have reported it to Epic; we'll see what they about that.

This works very well for rectangular solids, spheres and cylinders (the three types of PrimitiveComponents).

share|improve this answer
add comment

When you spawn the Actor for collision checks, what is that actor's CollisionComponent set to? I think if you set its CollisionComponent to a copy of that blue box mesh, it will do its collision (and thus "Touching") checks based off of that component. (the component will probably need to have CollideActor=true)

share|improve this answer
    
The collision component is a copy of the blue box mesh, as you suggest. –  Almo Dec 13 '12 at 16:12
    
Ah. Yeah, doing some more research it appears that Unreal collision between two actors requires one of the actors to use AABB. :( –  Phillip Dec 14 '12 at 15:41
    
Is this the case even for Actor-Actor with no KActors involved? –  Almo Dec 14 '12 at 15:49
    
It would appear so. :/ Of course, with PHYS_RigidBody, you can do checks against more complex collision. Also, I suppose you could check for actors within the cube by approximating its shape. For example, you could do multiple radius checks (via something like CollidingActors()) along the "path" of the cube. –  Phillip Dec 17 '12 at 22:16
    
Thanks for your help. I'll update this question with the best solution I can once I have it. –  Almo Dec 17 '12 at 23:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.