Collision handling for overlaping fixtures
Posted: Wed Jun 23, 2021 6:35 pm
I need to implement behavior as follows:
There are two dynamic fixtures A and B and there is another static fixture G which acts as a ground. I want both fixture A and B to be affected by gravity and they need to be stopped by fixture G. Simple enough, I did it. The next thing is, both these fixtures A and B should be able to pass one through the other, but still generate lp callbacks. Basically they need to act as sensors to one another, but act as NOT sensors to everything else, including G fixture (so they don't fall through).
How can I manage to do this? I set A to category 2 and B to category 3. If I set the masks for these, they would be able to pass through one another, but don't generate lp callbacks. Without masks they generate lp callbacks, but can't pass through one another. If I make any of the bodies a sensor, two bodies would interact as I need, but sensor would fall through the ground.
Can anyone help me? I do not use any physics wrappers or libraries. If it can't be done with vanilla lp, than maybe you know a library that can do it.
If nothing works, than I would need to make an annoying workaround of duplicating the fixtures for both objects, make one of them affected by gravity and set a mask for the other object, and the second fixture to set as a sensor. This should work, but feels janky and unnecessary.
Thank you for any helpful replies.
There are two dynamic fixtures A and B and there is another static fixture G which acts as a ground. I want both fixture A and B to be affected by gravity and they need to be stopped by fixture G. Simple enough, I did it. The next thing is, both these fixtures A and B should be able to pass one through the other, but still generate lp callbacks. Basically they need to act as sensors to one another, but act as NOT sensors to everything else, including G fixture (so they don't fall through).
How can I manage to do this? I set A to category 2 and B to category 3. If I set the masks for these, they would be able to pass through one another, but don't generate lp callbacks. Without masks they generate lp callbacks, but can't pass through one another. If I make any of the bodies a sensor, two bodies would interact as I need, but sensor would fall through the ground.
Can anyone help me? I do not use any physics wrappers or libraries. If it can't be done with vanilla lp, than maybe you know a library that can do it.
If nothing works, than I would need to make an annoying workaround of duplicating the fixtures for both objects, make one of them affected by gravity and set a mask for the other object, and the second fixture to set as a sensor. This should work, but feels janky and unnecessary.
Thank you for any helpful replies.