Skip to content

Commit

Permalink
fix: less invasive solve_character_collision_impulses function
Browse files Browse the repository at this point in the history
Taking ownership of the elements is not necessary.

It also conveys the information that elements are only read.
  • Loading branch information
Vrixyz committed Jun 12, 2024
1 parent b3dc1c1 commit 32e05c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/control/character_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,15 @@ impl KinematicCharacterController {
/// 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(
pub fn solve_character_collision_impulses<'a>(
&self,
dt: Real,
bodies: &mut RigidBodySet,
colliders: &ColliderSet,
queries: &QueryPipeline,
character_shape: &dyn Shape,
character_mass: Real,
collisions: impl IntoIterator<Item = CharacterCollision>,
collisions: impl IntoIterator<Item = &'a CharacterCollision>,
filter: QueryFilter,
) {
for collision in collisions {
Expand All @@ -805,7 +805,7 @@ impl KinematicCharacterController {
queries,
character_shape,
character_mass,
&collision,
collision,
filter,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src_testbed/testbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> Testbed<'a, 'b, 'c, 'd, 'e, 'f> {
&phx.query_pipeline,
character_collider.shape(),
character_mass,
collisions,
&*collisions,
QueryFilter::new().exclude_rigid_body(character_handle),
);

Expand Down

0 comments on commit 32e05c7

Please sign in to comment.