Skip to content

Commit

Permalink
Merge pull request #529 from Linentio/master
Browse files Browse the repository at this point in the history
Use the absolute value of the up attribute when calculating up_extent and side_extent
  • Loading branch information
sebcrozet authored Oct 1, 2023
2 parents dfb4f2a + 6c901d5 commit 82416e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/control/character_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ impl KinematicCharacterController {

fn compute_dims(&self, character_shape: &dyn Shape) -> Vector2<Real> {
let extents = character_shape.compute_local_aabb().extents();
let up_extent = extents.dot(&self.up);
let side_extent = (extents - *self.up * up_extent).norm();
let up_extent = extents.dot(&self.up.abs());
let side_extent = (extents - (*self.up).abs() * up_extent).norm();
Vector2::new(side_extent, up_extent)
}

Expand Down Expand Up @@ -679,7 +679,7 @@ impl KinematicCharacterController {
filter: QueryFilter,
) {
let extents = character_shape.compute_local_aabb().extents();
let up_extent = extents.dot(&self.up);
let up_extent = extents.dot(&self.up.abs());
let movement_to_transfer =
*collision.toi.normal1 * collision.translation_remaining.dot(&collision.toi.normal1);
let prediction = self.predict_ground(up_extent);
Expand Down

0 comments on commit 82416e3

Please sign in to comment.