[Solved] Sensors And Objects I'm Already Collided With

I have a (dynamic) camera object which collides with its environment.

If the camera is currently touching a boundary, it turns itself into a sensor as to avoid getting stuck. When I turn the (dyanamic) camera shape into a sensor, it goes through new (static) environment shapes it encounters, but not (static) environment shapes it was already collided with.


The behavior I desire would be to collide the camera with the environment, turn the camera into a sensor, then have the camera go through all objects while a sensor, not just ones it wasn't already collided with.
Version 2.0.1 supports a refiltering of shapes. Use b2World::Refilter.
I'm using the Java port at the moment. Wonder if that's up to date 🙂

If not, is there any way I could do this myself? I'd rather to have a nicely working camera.
You can look at the C++ implementation. It shouldn't be too difficult to replicate in Java.
I'll post back if I have any troubles. Thanks.
The Java update to 2.0.1 is planned, but I've got a lot on my todo list right now, so it might be a week or two before I get around to it (there are a lot of changes, so I'm biting off slightly smaller tasks at the moment, plus I'm on vacation right now). If you want to port that feature yourself, you can diff the current C++ b2World.cpp/h against rev 118, which is the rev that the Java port got up to, to see what's changed. You'll need to add the refilterProxy function to Shape, too, but it looks pretty straightforward - let me know if you need help.

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