Fix snap to ground being triggered on exactly perpendicular movement

This commit is contained in:
Jan Hohenheim
2023-02-04 21:41:50 +01:00
parent e69f7534d7
commit 7e1fb6f877

View File

@@ -324,7 +324,7 @@ impl KinematicCharacterController {
result: &mut EffectiveCharacterMovement,
) -> Option<(ColliderHandle, TOI)> {
if let Some(snap_distance) = self.snap_to_ground {
if result.translation.dot(&self.up) < 1.0e-5 {
if result.translation.dot(&self.up) < -1.0e-5 {
let snap_distance = snap_distance.eval(dims.y);
let offset = self.offset.eval(dims.y);
if let Some((hit_handle, hit)) = queries.cast_shape(