This project is read-only.

Sensors and Static Bodies

Mar 5, 2010 at 2:43 PM

First - Thanks for your work porting Box2d to xna - it works great.

I have the following problem: I have a dungeon where the walls are static bodies.

I want to create an explosion that senses when it comes into contact with walls.

I have the explosion configured as a static sensor - but it only collides with dynamic bodies, not the static walls. 

Are sensors limited to collisions against dynamic bodies?


Thanks for any feedback/advice and thanks again for porting box2d to xna.


Mar 5, 2010 at 7:31 PM

I got it to work - the sensor has to be dynamic, then it will collide with other static bodies..

Mar 6, 2010 at 9:38 PM

That's not very intuitive but I think it is by design.  The collision code will bail out pretty early as an optimization and that is probably what you are hitting with the static vs static collisions.

The workaround as you discovered is to make the sensor dynamic, but I'll try to dig in some more to see if this is really by design with respect to the C++ version.