Child Renderer offset when Rigidbody is enabled

Somehow my child gameobject (child[0]) get’s moved when the parent empty has a rigidbody component enabled.

A couple of things I already tried without effect:

  • setting the rigidbody to kinematic
  • resetting the position of the renderer via code
  • disabling gpu instancing on the material
  • removing the second (sphere) collider

so far it only makes a difference if I remove the rigidbody on the parent gameobject.

Original Post on Discord

by user 165409711020179457

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

on further inspection it seems related to offset of the box collider component.
Here I tried adding a cube with a boxcollider to the rigidbody.
If the boxcollider offset is (0,0,0) it’s at the right place, but if the boxcollider offset is (0,0,-1) you can notice a significant displacement (see screenshot)

by user 165409711020179457

For now I will just seperate the collider from the renderer - this should still be looked at nonetheless. :slightly_smiling_face: :wave:

by user 165409711020179457

  1. You enable the rigidbody at runtime
  2. or it happens when the rigidbody is on the parent with the child boxcollider + offset (0,0,-1) ?
  1. this happens with rigid bodies active during build time. Doesn’t matter if spawned or as part of the regular scene.
  2. yes, the setup is an empty parent with a rigid body and a child with a box collider and a renderer. The offset is not set on the transform but on the box collider component.

by user 165409711020179457

Doesn’t seem to affect sphere collider offsets in the same way.

by user 165409711020179457

Seems to be related to the rotation of the Rigidbody where the offset happens in the wrong direction. Thanks

It should be fixed in the next release