dimforge / dimforge/bevy_rapier

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

Open
#549 0 comments 0 reactions 0 assignees View on GitHub
A-Integration D-Medium P-Medium
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

![image](https://github.com/dimforge/bevy_rapier/assets/39656812/083d151f-f6a5-452c-87f9-3b743d4a5c4a)

```rust
// 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.

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.