From 9daa741af2d2efa0358db5ce94a4879e7e437b84 Mon Sep 17 00:00:00 2001 From: Jan Nils Ferner Date: Sat, 28 Jan 2023 00:03:50 +0100 Subject: Fix missing ground assignment --- src/control/character_controller.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index defa48f..2649193 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -410,6 +410,9 @@ impl KinematicCharacterController { for m in &manifolds { let normal = -(character_pos * m.local_n1); + if normal.dot(&self.up) >= -1e-5 { + grounded = true; + } if let Some(kinematic_parent) = kinematic_parent { let mut num_active_contacts = 0; @@ -456,7 +459,7 @@ impl KinematicCharacterController { for m in &manifolds { let normal = character_pos * m.local_n1; - if normal.dot(&self.up) <= -1.0e-5 { + if normal.dot(&self.up) <= 1.0e-5 { for contact in &m.points { if contact.dist <= prediction { grounded = true; -- cgit