dimforge / dimforge/bevy_rapier

Entity converted to rigidbody with child collider doesnt receive physics

Open
#648 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.