bevy_rapier icon indicating copy to clipboard operation
bevy_rapier copied to clipboard

RigidBody causing error with Child's position by parent's scale. Really Critical issue !!!.

Open HyeokSuLee opened this issue 1 year ago • 0 comments

image

// setting
Parent -> insert(TransformBundle::default())
Child ->  insert(TransformBundle::default(), Collider::cuboid(1,1,1),  **RigidBody::Fixed**) // **problem

Parent = Transform [ scale(1,1,1), position(0,0,0) ]
Child = Transform [ scale(1,1,1), position(-100, 100, 0) ]

// if parent's scale set to (1.1, 1.5, 0.0)
// without rigidbody
Parent = Transform [ scale(1.1, 1.5, 1.0), position(0,0,0) ], GlobalTransform [ scale(1.1, 1.5, 1.0), position(0,0,0) ]
Child = Transform [ scale(1, 1, 1), position(-100, 100, 0) ], GlobalTransform [ scale(1.1, 1.5, 1.0), position(-110, 150, 0) ]

// with rigidbody
Parent = Transform [ scale(1.1, 1.5, 1.0), position(0,0,0) ], GlobalTransform [ scale(1.1, 1.5, 1.0), position(0,0,0) ]
Child = Transform [ scale(1, 1, 1), position(-110, 150, 0) ], GlobalTransform [ scale(1.1, 1.5, 1.0), position(-121, 225, 0) ]

Without rigidbody, child's position is perfect which moves by parent's scale. But with rigidbody, child's position is wierd. I read that rigidbody is calculated based on globaltransform. So I think when after parent's scale changed, Rapier calculate the child's local position based on child's global scale before bevy's Transform system. I think that is why child's local position is not (-100, 100, 0) when with rigidbody. It seems rigidbody's Transform calculation need to be fixed.

HyeokSuLee avatar Jul 01 '24 17:07 HyeokSuLee