One way collision detection?

Topics: Developer Forum, User Forum
Jun 28, 2012 at 2:44 AM

I'll lay out my problem first for context.  

I've got a missle object that explodes at a distance, basically a proximity bomb.   I have one Sensor fixture that is used to trigger the explosion when near enemy objects.

Now, I have a second Fixture that represents the explosion blast radius which is larger than the proximity range.  This fixture is set to collide with nothing at first,  then AFTER the trigger hits something, I switch the collision on for the blast radius, and let it process one more step to collide and damage.

 

My question is firstly,  is there a way to have other objects NOT report collisions with my sensor/proximity fixture?  Only the sensor needs to know when it collides,  but as far as I can tell,  collisions are always broadcast to all involved parties.  I'm having to do some unpleasant workarounds to detect and ignore the proximity collisions.

Second question is,  anyone know a better / more elegant way to accomplish this kind of two-size collision? 

Thanks!

Jun 28, 2012 at 2:16 PM

Why not just use World.QueryAABB() for a spatial query to find out what's in the blast radius and act accordingly (make stuff explode). If you want stuff to hide behind walls then after you get the result from the query cast a ray: World.Raycast() from the center of explosion to the center of the found bodies to find out if there is a clean line of sight. I know this might seem low-level but as per your requirements it's extremely fast and elegant especially compared to trying to make the physics engine do unphysical stuff like having to deal with collision objects materializing out of thin air and being where they are not supposed to be :)