aboutsummaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-10-02 17:55:23 +0200
committerSébastien Crozet <developer@crozet.re>2022-10-02 17:55:23 +0200
commita8865296695db04969e9dbe806c489187ba20d0d (patch)
tree6475d8bdd327d26ff576577e3d2a01018d887864 /src/control
parent36e85d0708e53a01731dfa95a9a2b4792ef03fe2 (diff)
downloadrapier-a8865296695db04969e9dbe806c489187ba20d0d.tar.gz
rapier-a8865296695db04969e9dbe806c489187ba20d0d.tar.bz2
rapier-a8865296695db04969e9dbe806c489187ba20d0d.zip
Fix warnings
Diffstat (limited to 'src/control')
-rw-r--r--src/control/character_controller.rs16
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,