Skip to content

Commit

Permalink
Take entity bevy transform scale into account on writeback (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored May 21, 2024
1 parent 032bd5c commit 0110ee9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Derive `Debug` for `LockedAxes`.
- Expose `is_sliding_down_slope` to both `MoveShapeOutput` and `KinematicCharacterControllerOutput`.

### Fix

- Fix rigidbodies never going to sleep when a scale was applied to their `Transform`.

## v0.26.0 (05 May 2024)

**This is an update to Rapier 0.19 which includes several stability improvements
Expand Down
5 changes: 5 additions & 0 deletions src/plugin/systems/rigid_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ pub fn writeback_rigid_bodies(
}

if let Some(mut transform) = transform {
// NOTE: Rapier's `RigidBody` doesn't know its own scale as it is encoded
// directly within its collider, so we have to retrieve it from
// the scale of its bevy transform.
interpolated_pos = interpolated_pos.with_scale(transform.scale);

// NOTE: we query the parent’s global transform here, which is a bit
// unfortunate (performance-wise). An alternative would be to
// deduce the parent’s global transform from the current entity’s
Expand Down

0 comments on commit 0110ee9

Please sign in to comment.