Move main ground detection duty to snapping to ground
This commit is contained in:
@@ -193,8 +193,8 @@ impl KinematicCharacterController {
|
|||||||
|
|
||||||
let mut translation_remaining = desired_translation;
|
let mut translation_remaining = desired_translation;
|
||||||
|
|
||||||
// Check if we are grounded at the initial position.
|
// Apply friction
|
||||||
let grounded_at_starting_pos = self.detect_grounded_status_and_apply_friction(
|
self.detect_grounded_status_and_apply_friction(
|
||||||
dt,
|
dt,
|
||||||
bodies,
|
bodies,
|
||||||
colliders,
|
colliders,
|
||||||
@@ -299,7 +299,6 @@ impl KinematicCharacterController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If needed, and if we are not already grounded, 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(
|
self.snap_to_ground(
|
||||||
bodies,
|
bodies,
|
||||||
colliders,
|
colliders,
|
||||||
@@ -310,7 +309,7 @@ impl KinematicCharacterController {
|
|||||||
filter,
|
filter,
|
||||||
&mut result,
|
&mut result,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// Return the result.
|
// Return the result.
|
||||||
result
|
result
|
||||||
|
|||||||
Reference in New Issue
Block a user