Remove debug prints

This commit is contained in:
Jan Nils Ferner
2023-01-26 21:21:09 +01:00
parent 6701108f6f
commit 3cabe58ac6

View File

@@ -247,42 +247,32 @@ impl KinematicCharacterController {
toi, toi,
}); });
// If the slope is too big, try to step on the stair. if ![self.up, -self.up] // Try to move up or down stairs
if !self.handle_stairs( .iter()
bodies, .any(|up| self.handle_stairs(
colliders, bodies,
queries, colliders,
character_shape, queries,
&(Translation::from(result.translation) * character_pos), character_shape,
&dims, &(Translation::from(result.translation) * character_pos),
filter, &dims,
handle, filter,
&mut translation_remaining, handle,
&mut result, &mut translation_remaining,
&self.up &mut result,
) && !self.handle_stairs( up
bodies, )) {
colliders, // No stairs, try to move along slopes.
queries, if let Some(translation_on_slope) =
character_shape, self.handle_slopes(&toi, &mut translation_remaining, offset)
&(Translation::from(result.translation) * character_pos), {
&dims, translation_remaining = translation_on_slope;
filter, } else {
handle, // No slopes or stairs ahead; try to move along obstacles.
&mut translation_remaining, let allowed_translation = subtract_hit(translation_remaining, &toi, offset);
&mut result, result.translation += allowed_translation;
&-self.up translation_remaining -= allowed_translation;
){ }
if let Some(translation_on_slope) =
self.handle_slopes(&toi, &mut translation_remaining, offset)
{
translation_remaining = translation_on_slope;
} else {
// No slopes or stairs ahead; try to move along obstacles.
let allowed_translation = subtract_hit(translation_remaining, &toi, offset);
result.translation += allowed_translation;
translation_remaining -= allowed_translation;
}
} }
} else { } else {
@@ -498,8 +488,6 @@ impl KinematicCharacterController {
// Check if there is a slope to climb. // Check if there is a slope to climb.
let angle_with_floor = self.up.angle(&hit.normal1); let angle_with_floor = self.up.angle(&hit.normal1);
let climbing = self.up.dot(&slope_translation) >= 0.0; let climbing = self.up.dot(&slope_translation) >= 0.0;
println!("angle_with_floor: {}, climbing: {}", angle_with_floor, climbing);
println!("max_slope_climb_angle: {}, min_slope_slide_angle: {}", self.max_slope_climb_angle, self.min_slope_slide_angle);
climbing climbing
.then(||(angle_with_floor <= self.max_slope_climb_angle) // Are we allowed to climb? .then(||(angle_with_floor <= self.max_slope_climb_angle) // Are we allowed to climb?