aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/control/character_controller.rs33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs
index 87b5c16..dc7381f 100644
--- a/src/control/character_controller.rs
+++ b/src/control/character_controller.rs
@@ -782,8 +782,8 @@ impl KinematicCharacterController {
true
}
- /// 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.
+ /// For the given collisions between a character and its environment, this method will apply
+ /// impulses to the rigid-bodies surrounding the character shape at the time of the collisions.
/// 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(
@@ -794,6 +794,35 @@ impl KinematicCharacterController {
queries: &QueryPipeline,
character_shape: &dyn Shape,
character_mass: Real,
+ collisions: impl IntoIterator<Item = CharacterCollision>,
+ filter: QueryFilter,
+ ) {
+ for collision in collisions {
+ self.solve_single_character_collision_impulse(
+ dt,
+ bodies,
+ colliders,
+ queries,
+ character_shape,
+ character_mass,
+ &collision,
+ filter,
+ );
+ }
+ }
+
+ /// For the 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.
+ fn solve_single_character_collision_impulse(
+ &self,
+ dt: Real,
+ bodies: &mut RigidBodySet,
+ colliders: &ColliderSet,
+ queries: &QueryPipeline,
+ character_shape: &dyn Shape,
+ character_mass: Real,
collision: &CharacterCollision,
filter: QueryFilter,
) {