aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-10-27 16:48:05 +0100
committerCrozet Sébastien <developer@crozet.re>2020-10-27 16:49:24 +0100
commit3bfa4079999f6c886e692de256abf51e4506a2b1 (patch)
tree23d0120978ba7e7c5f1003b87919526536793bd7 /src
parent24bd97636e890195c8a72f8e265809bbae44ab13 (diff)
downloadrapier-3bfa4079999f6c886e692de256abf51e4506a2b1.tar.gz
rapier-3bfa4079999f6c886e692de256abf51e4506a2b1.tar.bz2
rapier-3bfa4079999f6c886e692de256abf51e4506a2b1.zip
ContactPairFilter: don't overwrite the effect of the solver groups.
This is more consistent with the fact that the effect of collision groups is not overwritten either.
Diffstat (limited to 'src')
-rw-r--r--src/geometry/narrow_phase.rs20
-rw-r--r--src/geometry/user_callbacks.rs11
-rw-r--r--src/pipeline/physics_pipeline.rs4
3 files changed, 18 insertions, 17 deletions
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs
index fd2652d..69678cd 100644
--- a/src/geometry/narrow_phase.rs
+++ b/src/geometry/narrow_phase.rs
@@ -320,10 +320,10 @@ impl NarrowPhase {
if let Some(filter) = pair_filter {
let context = PairFilterContext {
- collider1: co1,
- collider2: co2,
rigid_body1: rb1,
rigid_body2: rb2,
+ collider1: co1,
+ collider2: co2,
};
if !filter.filter_proximity_pair(&context) {
@@ -389,12 +389,12 @@ impl NarrowPhase {
return;
}
- let solver_flags = if let Some(filter) = pair_filter {
+ let mut solver_flags = if let Some(filter) = pair_filter {
let context = PairFilterContext {
- collider1: co1,
- collider2: co2,
rigid_body1: rb1,
rigid_body2: rb2,
+ collider1: co1,
+ collider2: co2,
};
if let Some(solver_flags) = filter.filter_contact_pair(&context) {
@@ -404,13 +404,13 @@ impl NarrowPhase {
return;
}
} else {
- if co1.solver_groups.test(co2.solver_groups) {
- SolverFlags::COMPUTE_IMPULSES
- } else {
- SolverFlags::empty()
- }
+ SolverFlags::COMPUTE_IMPULSES
};
+ if !co1.solver_groups.test(co2.solver_groups) {
+ solver_flags.remove(SolverFlags::COMPUTE_IMPULSES);
+ }
+
let dispatcher = DefaultContactDispatcher;
if pair.generator.is_none() {
// We need a redispatch for this generator.
diff --git a/src/geometry/user_callbacks.rs b/src/geometry/user_callbacks.rs
index 9b36695..ae0119f 100644
--- a/src/geometry/user_callbacks.rs
+++ b/src/geometry/user_callbacks.rs
@@ -4,13 +4,13 @@ use crate::geometry::{Collider, SolverFlags};
/// Context given to custom collision filters to filter-out collisions.
pub struct PairFilterContext<'a> {
/// The first collider involved in the potential collision.
- pub collider1: &'a Collider,
- /// The first collider involved in the potential collision.
- pub collider2: &'a Collider,
- /// The first collider involved in the potential collision.
pub rigid_body1: &'a RigidBody,
/// The first collider involved in the potential collision.
pub rigid_body2: &'a RigidBody,
+ /// The first collider involved in the potential collision.
+ pub collider1: &'a Collider,
+ /// The first collider involved in the potential collision.
+ pub collider2: &'a Collider,
}
/// User-defined filter for potential contact pairs detected by the broad-phase.
@@ -24,9 +24,6 @@ pub trait ContactPairFilter: Send + Sync {
/// Note that using a contact pair filter will replace the default contact filtering
/// which consists of preventing contact computation between two non-dynamic bodies.
///
- /// Note that using a contact pair filter will replace the default determination
- /// of solver flags, based on the colliders solver groups.
- ///
/// This filtering method is called after taking into account the colliders collision groups.
///
/// If this returns `None`, then the narrow-phase will ignore this contact pair and
diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs
index b99934b..0720ff1 100644
--- a/src/pipeline/physics_pipeline.rs
+++ b/src/pipeline/physics_pipeline.rs
@@ -290,6 +290,8 @@ mod test {
&mut bodies,
&mut colliders,
&mut joints,
+ None,
+ None,
&(),
);
}
@@ -332,6 +334,8 @@ mod test {
&mut bodies,
&mut colliders,
&mut joints,
+ None,
+ None,
&(),
);
}