Reintroduce offset
This commit is contained in:
@@ -267,7 +267,7 @@ impl KinematicCharacterController {
|
|||||||
translation_remaining = translation_on_slope;
|
translation_remaining = translation_on_slope;
|
||||||
} else {
|
} else {
|
||||||
// No slopes or stairs ahead; try to move along obstacle.
|
// 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;
|
result.translation += allowed_translation;
|
||||||
translation_remaining -= allowed_translation;
|
translation_remaining -= allowed_translation;
|
||||||
}
|
}
|
||||||
@@ -606,7 +606,7 @@ impl KinematicCharacterController {
|
|||||||
) {
|
) {
|
||||||
let [_vertical_slope_translation, horizontal_slope_translation] =
|
let [_vertical_slope_translation, horizontal_slope_translation] =
|
||||||
self.split_into_components(translation_remaining)
|
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);
|
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> {
|
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
|
translation - *hit.normal1 * hit_normal
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user