diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-10-02 17:55:23 +0200 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2022-10-02 17:55:23 +0200 |
| commit | a8865296695db04969e9dbe806c489187ba20d0d (patch) | |
| tree | 6475d8bdd327d26ff576577e3d2a01018d887864 /src | |
| parent | 36e85d0708e53a01731dfa95a9a2b4792ef03fe2 (diff) | |
| download | rapier-a8865296695db04969e9dbe806c489187ba20d0d.tar.gz rapier-a8865296695db04969e9dbe806c489187ba20d0d.tar.bz2 rapier-a8865296695db04969e9dbe806c489187ba20d0d.zip | |
Fix warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/control/character_controller.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 049aef8..b8f73bc 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -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, |
