bevy_xpbd
bevy_xpbd copied to clipboard
Fixes Colliders not properly removing their collisions when they get disabled, moved and enabled.
Objective
Whenever a Collider is disabled and moved away from a position, the collisions that it was triggering will come back to being active as soon as the Disabled component gets removed again, even if the collisions aren't happening.
Testing
Steps to test:
- Add a Collider Sensor and add some other Colliders within it so that the collisions activate.
- Disable the Collider Sensor. The collisions will deactivate.
- Now move the Collider Sensor away and then re-enable it.
- Previous to the patch the collisions activate again, even if they're not really colliding.
- With the patch the collisions stay disabled.
Video of bugged behavior:
https://github.com/user-attachments/assets/7d3ee145-8543-4f85-84f4-3c2255297e7a
The pink area is a simple system that propels colliding bodies upward, and as you can see in the video it works even when they're not in contact. PR solves the issue completely.
After further testing I've noticed that even though this change fixes the error it mentions it now creates another strange behavior that I can't yet fully articulate. But basically now it seems like when not Disabling entities at all sometimes Entering/Exiting collisions don't trigger at all :( I'm not really sure what's wrong rn but it's worth looking into and I'll try investigating a bit further.