Try to fix offset

This commit is contained in:
Jan Nils Ferner
2023-01-26 23:33:53 +01:00
parent b69c9c4813
commit 6a437f47a9

View File

@@ -365,7 +365,7 @@ impl KinematicCharacterController {
mut kinematic_friction_translation: Option<&mut Vector<Real>>, mut kinematic_friction_translation: Option<&mut Vector<Real>>,
mut translation_remaining: Option<&mut Vector<Real>>, mut translation_remaining: Option<&mut Vector<Real>>,
) -> bool { ) -> bool {
let prediction = self.offset.eval(dims.y) * 1.2; let prediction = self.offset.eval(dims.y) * 1.1;
// TODO: allow custom dispatchers. // TODO: allow custom dispatchers.
let dispatcher = DefaultQueryDispatcher; let dispatcher = DefaultQueryDispatcher;
@@ -603,7 +603,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, offset)); .map(|remaining| subtract_hit(remaining, &hit, 0.));
let angle_with_floor = self.up.angle(&hit.normal1); let angle_with_floor = self.up.angle(&hit.normal1);
@@ -628,7 +628,7 @@ impl KinematicCharacterController {
false, false,
filter, filter,
) )
.map(|hit| hit.1.toi + offset) .map(|hit| hit.1.toi)
.unwrap_or(max_height); .unwrap_or(max_height);
// Remove the step height from the vertical part of the self. // Remove the step height from the vertical part of the self.
@@ -664,7 +664,7 @@ impl KinematicCharacterController {
let up_extent = extents.dot(&self.up); let up_extent = extents.dot(&self.up);
let movement_to_transfer = let movement_to_transfer =
*collision.toi.normal1 * collision.translation_remaining.dot(&collision.toi.normal1); *collision.toi.normal1 * collision.translation_remaining.dot(&collision.toi.normal1);
let prediction = self.offset.eval(up_extent) * 1.2; let prediction = self.offset.eval(up_extent) * 1.1;
// TODO: allow custom dispatchers. // TODO: allow custom dispatchers.
let dispatcher = DefaultQueryDispatcher; let dispatcher = DefaultQueryDispatcher;