diff options
| author | Jan Nils Ferner <contact@jnferner.com> | 2023-01-26 23:15:01 +0100 |
|---|---|---|
| committer | Jan Nils Ferner <contact@jnferner.com> | 2023-01-26 23:15:01 +0100 |
| commit | c63e2f2cbd8e88c6a22faf62fe4c6e4e7aca45e1 (patch) | |
| tree | 32c8df4a93b41805efade5996bb8df853c01b03d /src/control/character_controller.rs | |
| parent | ff7ccc561ad88f7f068f083fa2ab6f413f5a8fb9 (diff) | |
| download | rapier-c63e2f2cbd8e88c6a22faf62fe4c6e4e7aca45e1.tar.gz rapier-c63e2f2cbd8e88c6a22faf62fe4c6e4e7aca45e1.tar.bz2 rapier-c63e2f2cbd8e88c6a22faf62fe4c6e4e7aca45e1.zip | |
Fix faulty offset application
Diffstat (limited to 'src/control/character_controller.rs')
| -rw-r--r-- | src/control/character_controller.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 6c2d89f..0714749 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -615,7 +615,7 @@ impl KinematicCharacterController { } // We can step, we need to find the actual step height. - let step_height = offset + max_height + let step_height = max_height - queries .cast_shape( bodies, @@ -628,12 +628,12 @@ impl KinematicCharacterController { false, filter, ) - .map(|hit| hit.1.toi) + .map(|hit| hit.1.toi + offset) .unwrap_or(max_height); // Remove the step height from the vertical part of the self. *translation_remaining -= - *self.up * ((translation_remaining.dot(&self.up)).clamp(0.0, step_height) + offset); + *self.up * ((translation_remaining.dot(&self.up)).clamp(0.0, step_height)); // Advance the collider on the step horizontally, to make sure further // movement won’t just get stuck on its edge. |
