Fix faulty offset application
This commit is contained in:
@@ -615,7 +615,7 @@ impl KinematicCharacterController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We can step, we need to find the actual step height.
|
// We can step, we need to find the actual step height.
|
||||||
let step_height = offset + max_height
|
let step_height = max_height
|
||||||
- queries
|
- queries
|
||||||
.cast_shape(
|
.cast_shape(
|
||||||
bodies,
|
bodies,
|
||||||
@@ -628,12 +628,12 @@ impl KinematicCharacterController {
|
|||||||
false,
|
false,
|
||||||
filter,
|
filter,
|
||||||
)
|
)
|
||||||
.map(|hit| hit.1.toi)
|
.map(|hit| hit.1.toi + offset)
|
||||||
.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.
|
||||||
*translation_remaining -=
|
*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
|
// Advance the collider on the step horizontally, to make sure further
|
||||||
// movement won’t just get stuck on its edge.
|
// movement won’t just get stuck on its edge.
|
||||||
|
|||||||
Reference in New Issue
Block a user