aboutsummaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authorJan Hohenheim <jan@hohenheim.ch>2023-02-04 21:05:54 +0100
committerJan Hohenheim <jan@hohenheim.ch>2023-02-04 21:05:54 +0100
commit760ea8d498c7dfc99d59342c8ec492de193ffed9 (patch)
tree18cbaa4fedf9ad40478c1b849c4904692c77e338 /src/control
parent8d182cef7d30f1c81e447a475ab916137a567b4d (diff)
downloadrapier-760ea8d498c7dfc99d59342c8ec492de193ffed9.tar.gz
rapier-760ea8d498c7dfc99d59342c8ec492de193ffed9.tar.bz2
rapier-760ea8d498c7dfc99d59342c8ec492de193ffed9.zip
Fix moving along obstacle twice per iteration
Diffstat (limited to 'src/control')
-rw-r--r--src/control/character_controller.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs
index abccfee..b6d2dcc 100644
--- a/src/control/character_controller.rs
+++ b/src/control/character_controller.rs
@@ -263,8 +263,8 @@ impl KinematicCharacterController {
self.handle_slopes(&toi, &mut translation_remaining, offset)
{
translation_remaining = translation_on_slope;
- } else {
- // No slopes or stairs ahead; try to move along obstacle.
+ } else if allowed_dist < 1.0e5 {
+ // No slopes or stairs ahead, but we didn't move yet; try to move along obstacle.
let allowed_translation = subtract_hit(translation_remaining, &toi, offset);
result.translation += allowed_translation;
translation_remaining -= allowed_translation;