aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Nils Ferner <contact@jnferner.com>2023-01-27 00:13:21 +0100
committerJan Nils Ferner <contact@jnferner.com>2023-01-27 00:13:21 +0100
commite6035ed998e240bbf7092dd7ead612e766eca0d7 (patch)
treec4556ca787c954eb0c18d3391a74e5a1a4f3fe2b
parent30058a61ea90cc32270763894459d40941b7dd8d (diff)
downloadrapier-e6035ed998e240bbf7092dd7ead612e766eca0d7.tar.gz
rapier-e6035ed998e240bbf7092dd7ead612e766eca0d7.tar.bz2
rapier-e6035ed998e240bbf7092dd7ead612e766eca0d7.zip
Reintroduce offset
-rw-r--r--src/control/character_controller.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs
index a91e8b4..23dd12c 100644
--- a/src/control/character_controller.rs
+++ b/src/control/character_controller.rs
@@ -267,7 +267,7 @@ impl KinematicCharacterController {
translation_remaining = translation_on_slope;
} else {
// No slopes or stairs ahead; try to move along obstacle.
- let allowed_translation = subtract_hit(translation_remaining, &toi, 0.);
+ let allowed_translation = subtract_hit(translation_remaining, &toi, offset);
result.translation += allowed_translation;
translation_remaining -= allowed_translation;
}
@@ -606,7 +606,7 @@ impl KinematicCharacterController {
) {
let [_vertical_slope_translation, horizontal_slope_translation] =
self.split_into_components(translation_remaining)
- .map(|remaining| subtract_hit(remaining, &hit, 0.));
+ .map(|remaining| subtract_hit(remaining, &hit, offset));
let angle_with_floor = self.up.angle(&hit.normal1);
@@ -734,6 +734,6 @@ impl KinematicCharacterController {
}
fn subtract_hit(translation: Vector<Real>, hit: &TOI, offset: Real) -> Vector<Real> {
- let hit_normal = (translation.dot(&hit.normal1) * (1.0 + 0.)).min(0.0);
+ let hit_normal = (translation.dot(&hit.normal1) * (1.0 + offset)).min(0.0);
translation - *hit.normal1 * hit_normal
}