Remove overzealous ground-snapping

This commit is contained in:
Jan Hohenheim
2023-02-04 19:41:01 +01:00
parent 6c5713aa0c
commit b461d028df

View File

@@ -193,7 +193,7 @@ impl KinematicCharacterController {
let mut translation_remaining = desired_translation;
self.detect_grounded_status_and_apply_friction(
let grounded_at_starting_pos = self.detect_grounded_status_and_apply_friction(
dt,
bodies,
colliders,
@@ -294,8 +294,8 @@ impl KinematicCharacterController {
break;
}
}
// If needed, snap to the ground.
// If needed, and if we are not already grounded, snap to the ground.
if grounded_at_starting_pos {
self.snap_to_ground(
bodies,
colliders,
@@ -306,6 +306,7 @@ impl KinematicCharacterController {
filter,
&mut result,
);
}
// Return the result.
result