aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2024-05-05 10:31:42 +0200
committerSébastien Crozet <sebastien@crozet.re>2024-05-05 16:17:39 +0200
commitd0866d423212be53e159c72315cec2e3dac04ac5 (patch)
tree6f2163895a2fa4fe076ccf4034e76487ea63a2bb
parent2b095b65b24b1f12fd1b43aa34a3c6a94b946fa6 (diff)
downloadrapier-d0866d423212be53e159c72315cec2e3dac04ac5.tar.gz
rapier-d0866d423212be53e159c72315cec2e3dac04ac5.tar.bz2
rapier-d0866d423212be53e159c72315cec2e3dac04ac5.zip
feat: rename CharacterCollision::toi to hit
-rw-r--r--src/control/character_controller.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs
index 7fdfcaa..465d0fa 100644
--- a/src/control/character_controller.rs
+++ b/src/control/character_controller.rs
@@ -112,7 +112,7 @@ pub struct CharacterCollision {
/// The translations that was still waiting to be applied to the character when the hit happens.
pub translation_remaining: Vector<Real>,
/// Geometric information about the hit.
- pub toi: ShapeCastHit,
+ pub hit: ShapeCastHit,
}
/// A character controller for kinematic bodies.
@@ -261,7 +261,7 @@ impl KinematicCharacterController {
}
// 2. Cast towards the movement direction.
- if let Some((handle, toi)) = queries.cast_shape(
+ if let Some((handle, hit)) = queries.cast_shape(
bodies,
colliders,
&(Translation::from(result.translation) * character_pos),
@@ -276,7 +276,7 @@ impl KinematicCharacterController {
filter,
) {
// We hit something, compute and apply the allowed interference-free translation.
- let allowed_dist = toi.time_of_impact;
+ let allowed_dist = hit.time_of_impact;
let allowed_translation = *translation_dir * allowed_dist;
result.translation += allowed_translation;
translation_remaining -= allowed_translation;
@@ -286,10 +286,10 @@ impl KinematicCharacterController {
character_pos: Translation::from(result.translation) * character_pos,
translation_applied: result.translation,
translation_remaining,
- toi,
+ hit,
});
- let hit_info = self.compute_hit_info(toi);
+ let hit_info = self.compute_hit_info(hit);
// Try to go upstairs.
if !self.handle_stairs(
@@ -800,7 +800,7 @@ impl KinematicCharacterController {
let extents = character_shape.compute_local_aabb().extents();
let up_extent = extents.dot(&self.up.abs());
let movement_to_transfer =
- *collision.toi.normal1 * collision.translation_remaining.dot(&collision.toi.normal1);
+ *collision.hit.normal1 * collision.translation_remaining.dot(&collision.hit.normal1);
let prediction = self.predict_ground(up_extent);
// TODO: allow custom dispatchers.