bevy_rapier
bevy_rapier copied to clipboard
Entity converted to rigidbody with child collider doesnt receive physics
I recently came across some curios behavior where a entity doesnt receive physics (isnt affected by gravity) when the rigidbody is added a few frames later.
- Create a entity without a RB
- Give that entity a child with a collider
- Wait a few frames
- Add the RB to the parent
Now, the entity doesn't move. Neither the child nor the parent. Using the Debug-Mode it appears that the collider is "parentless". When the parent-reference on the child is checked, it has a RB.
My expectations is, that the parent starts to be affected by gravity once the Rigidbody is added. A workaround has been suggested in the discord where a fixed RB is added from the very beginning.
I created a small example were the behavior can be reproduced: https://github.com/ValonPrime/proc_rbs_mre Notes for the Example:
- I changed the color for the Debug-Mode to better distinguish between them
- The left object has a RB from the very beginning
- The right object receives a RB when G is pressed on the keyboard
- All entities and their components can be printed to the console using the F1 key
- The before mentioned workaround has been implemented and can be enabled by setting the "DO_WORKAROUND" constant to true
Versions:
- Bevy 0.15.3
- Bevy-Rapier3D 0.29.0