Fix warnings

This commit is contained in:
Sébastien Crozet
2022-10-02 17:55:23 +02:00
parent 36e85d0708
commit a886529669
3 changed files with 21 additions and 4 deletions

View File

@@ -26,6 +26,8 @@ pub enum CharacterLength {
}
impl CharacterLength {
/// Returns `self` with its value changed by the closure `f` if `self` is the `Self::Absolute`
/// variant.
pub fn map_absolute(self, f: impl FnOnce(Real) -> Real) -> Self {
if let Self::Absolute(value) = self {
Self::Absolute(f(value))
@@ -34,6 +36,16 @@ impl CharacterLength {
}
}
/// Returns `self` with its value changed by the closure `f` if `self` is the `Self::Relative`
/// variant.
pub fn map_relative(self, f: impl FnOnce(Real) -> Real) -> Self {
if let Self::Relative(value) = self {
Self::Relative(f(value))
} else {
self
}
}
fn eval(self, value: Real) -> Real {
match self {
Self::Relative(x) => value * x,
@@ -647,6 +659,10 @@ impl KinematicCharacterController {
false
}
/// For a given collision between a character and its environment, this method will apply
/// impulses to the rigid-bodies surrounding the character shape at the time of the collision.
/// Note that the impulse calculation is only approximate as it is not based on a global
/// constraints resolution scheme.
pub fn solve_character_collision_impulses(
&self,
dt: Real,