bevy_rapier icon indicating copy to clipboard operation
bevy_rapier copied to clipboard

Entity converted to rigidbody with child collider doesnt receive physics

Open ValonPrime opened this issue 8 months ago • 0 comments

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.

  1. Create a entity without a RB
  2. Give that entity a child with a collider
  3. Wait a few frames
  4. 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

ValonPrime avatar Apr 18 '25 13:04 ValonPrime