From fa2be3fc9c4b646756d5cf7eb5b00a906d9b2362 Mon Sep 17 00:00:00 2001 From: Linentio <96549149+Linentio@users.noreply.github.com> Date: Sat, 30 Sep 2023 12:37:45 +0200 Subject: [PATCH 1/2] Use the absolute value of the up attribute when calculating up_extent --- src/control/character_controller.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 8f9ef2612..3a8aa40cf 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -521,7 +521,7 @@ impl KinematicCharacterController { fn compute_dims(&self, character_shape: &dyn Shape) -> Vector2 { let extents = character_shape.compute_local_aabb().extents(); - let up_extent = extents.dot(&self.up); + let up_extent = extents.dot(&self.up.abs()); let side_extent = (extents - *self.up * up_extent).norm(); Vector2::new(side_extent, up_extent) } @@ -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); From 6c901d57742205de0ebe191cd2c1acd94532f2d9 Mon Sep 17 00:00:00 2001 From: Linentio <96549149+Linentio@users.noreply.github.com> Date: Sat, 30 Sep 2023 13:27:50 +0200 Subject: [PATCH 2/2] Use the absolute value of the up attribute when calculating side_extent --- src/control/character_controller.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 3a8aa40cf..ca088b280 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -522,7 +522,7 @@ impl KinematicCharacterController { fn compute_dims(&self, character_shape: &dyn Shape) -> Vector2 { let extents = character_shape.compute_local_aabb().extents(); let up_extent = extents.dot(&self.up.abs()); - let side_extent = (extents - *self.up * up_extent).norm(); + let side_extent = (extents - (*self.up).abs() * up_extent).norm(); Vector2::new(side_extent, up_extent) }