Get contacts between steps?

Hi, this is quite possibly a very ignorant question - as I'm fairly new to Box2d. I have a game with the following setup -

1) A region (sensor)
2) An actor

The actor "enters" the region by detecting contacts with it, and "leaves" the region when all contacts with that region are ended.

There's code elsewhere that can check if an Actor is within a region - returning true/false. This all works fine except for the following scenario.

1) Actor enters the region
2) Actor changes animation while inside the region

When this happens, we're destroying the existing contacts and the existing body and creating a new one for the new animation. What I want to happen is for the contacts to be immediately reevaluated (ideally just for the new fixtures, not everything in the world) to detect that the Actor is still in the region. What does happen is that it has to wait for the next world step. So if the other code is checking for an Actor being in the region -- it will return false for that 1 frame before it detects it as being back in.

What's the best way to go about doing this? Again - this is probably a stupid question, but what are the implications of calling world.step with a first parameter of 0, just to reevalute the contacts? I'm assuming that's a very bad idea.

Thanks,
Greg

edit: forgot to mention that the "region" can be a circle or polygon shape. So just checking if the bounding boxes overlap would not be enough.
If anyone has any ideas/suggestions about this, I would really appreciate it. Thanks
If you are not changing the shape of the body when you change the animation, it would be safe to assume that if it was in the region before being changed, it still is. How about just recording whether it was in or not before you change it, and get the "code elsewhere that can check if an Actor is within a region" to use this to override what it would normally do - then clear that state after the timestep to go back to the normal behaviour.
irresistible force wrote:
If you are not changing the shape of the body when you change the animation, it would be safe to assume that if it was in the region before being changed, it still is. How about just recording whether it was in or not before you change it, and get the "code elsewhere that can check if an Actor is within a region" to use this to override what it would normally do - then clear that state after the timestep to go back to the normal behaviour.


Thank you for the reply. I actually should have specified this earlier, but the size/shape/location of the body can change from animation to animation. So on an animation switch - a body that used to be in a region may no longer be in the region (but it might be).

Original thread: https://box2d.org/forum/viewtopic.php?t=7322