I am instantiating a prefab that have a one-level hierarchy of children objects, some of which are basic cube shapes but with collider component attached. These children cube shapes with colliders always appear detached from the instantiated Entity (ie. not appearing under the parent entity, instead on the root level). What am I doing wrong? All other children but have no colliders are attached as children. (note: I also have rigidbody, mesh filter and mesh renderer on the problem cube shapes)
#Children 3D cube with collider component detaches from parent prefab when baking
1 messages · Page 1 of 1 (latest)
kinematic and dynamic rigidbodies are always unparented and worldspace during baking, this is by design for performance
thank you. what is the right thing to do to maintain the reliance on the intended parent transform for these children objects with colliders?
Actually, I've tried removing rigidbody component and just leaving collider (along with mesh filter and renderer), and the cube shape still detaches. So this is not because of rigidbody component, but because it is a collider.
So, I still don't understand the recommendation. What's the best practice approach?
Dynamic or kinematic physics bodies must always be at root, no parents
I see. Thanks. For the case that these bodies need to move in relation to the intended parent entities, I'd have to manually sync the movement in a System? Or is there a "right" approach in syncing movement of a physic bodies with what was originally its parent entity?
manually syncing them or using rigid joints
depends on what you want with those physics bodies
if you want true physics
then you can either use joints or manually assign velocity in a way, to make them always snap to "target" child position
if you just need triggers, I think maybe just moving them via local transform would be enough