Add some abs to checks

This commit is contained in:
Jan Nils Ferner
2023-01-27 18:08:12 +01:00
parent 0f6aa49422
commit 29dd3189ba

View File

@@ -413,7 +413,7 @@ impl KinematicCharacterController {
let normal1 = character_pos * m.local_n1; let normal1 = character_pos * m.local_n1;
let normal2 = -normal1; let normal2 = -normal1;
if normal1.dot(&self.up) <= -1.0e-5 { if normal1.dot(&self.up).abs() <= -1.0e-5 {
println!("Grounded 1"); println!("Grounded 1");
grounded = true; grounded = true;
} }
@@ -463,7 +463,7 @@ impl KinematicCharacterController {
for m in &manifolds { for m in &manifolds {
let normal = character_pos * m.local_n1; let normal = character_pos * m.local_n1;
if normal.dot(&self.up) <= -1.0e-5 { if normal.dot(&self.up).abs() <= -1.0e-5 {
for contact in &m.points { for contact in &m.points {
if contact.dist <= prediction { if contact.dist <= prediction {
println!("Grounded 2"); println!("Grounded 2");