Simplify code
This commit is contained in:
@@ -499,20 +499,16 @@ impl KinematicCharacterController {
|
|||||||
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;
|
||||||
|
|
||||||
climbing
|
if climbing {
|
||||||
.then(|| {
|
// Are we allowed to climb?
|
||||||
(angle_with_floor <= self.max_slope_climb_angle) // Are we allowed to climb?
|
(angle_with_floor <= self.max_slope_climb_angle).then_some(horizontal_translation)
|
||||||
.then_some(horizontal_translation)
|
}
|
||||||
})
|
// Are we allowed to slide?
|
||||||
.unwrap_or_else(|| {
|
else if angle_with_floor >= self.min_slope_slide_angle {
|
||||||
// Are we allowed to slide?
|
Some(slope_translation)
|
||||||
if angle_with_floor >= self.min_slope_slide_angle {
|
} else {
|
||||||
slope_translation
|
Some(horizontal_translation)
|
||||||
} else {
|
}
|
||||||
horizontal_translation
|
|
||||||
}
|
|
||||||
.into()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn split_into_components(&self, translation: &Vector<Real>) -> [Vector<Real>; 2] {
|
fn split_into_components(&self, translation: &Vector<Real>) -> [Vector<Real>; 2] {
|
||||||
|
|||||||
Reference in New Issue
Block a user