aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-11-19 11:07:00 +0100
committerCrozet Sébastien <developer@crozet.re>2020-11-23 15:56:53 +0100
commitaf39ec54d35b8c3777add6b6a597e5963067234d (patch)
tree74663c3763e0d7e2f56b375ca46ae0c00942fbec /src/dynamics
parentc641114f016c47f6b22acc084610847f88ff5a66 (diff)
downloadrapier-af39ec54d35b8c3777add6b6a597e5963067234d.tar.gz
rapier-af39ec54d35b8c3777add6b6a597e5963067234d.tar.bz2
rapier-af39ec54d35b8c3777add6b6a597e5963067234d.zip
Remove the narrow-phase graph indices from the collider.
They are on the narrow-phase now.
Diffstat (limited to 'src/dynamics')
-rw-r--r--src/dynamics/rigid_body_set.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs
index ec4d388..48d558f 100644
--- a/src/dynamics/rigid_body_set.rs
+++ b/src/dynamics/rigid_body_set.rs
@@ -3,7 +3,7 @@ use rayon::prelude::*;
use crate::data::arena::Arena;
use crate::dynamics::{BodyStatus, Joint, JointSet, RigidBody};
-use crate::geometry::{ColliderHandle, ColliderSet, ContactPair, InteractionGraph};
+use crate::geometry::{ColliderHandle, ColliderSet, ContactPair, InteractionGraph, NarrowPhase};
use crossbeam::channel::{Receiver, Sender};
use std::ops::{Deref, DerefMut, Index, IndexMut};
@@ -452,7 +452,7 @@ impl RigidBodySet {
pub(crate) fn update_active_set_with_contacts(
&mut self,
colliders: &ColliderSet,
- contact_graph: &InteractionGraph<ContactPair>,
+ narrow_phase: &NarrowPhase,
joint_graph: &InteractionGraph<Joint>,
min_island_size: usize,
) {
@@ -491,20 +491,22 @@ impl RigidBodySet {
fn push_contacting_colliders(
rb: &RigidBody,
colliders: &ColliderSet,
- contact_graph: &InteractionGraph<ContactPair>,
+ narrow_phase: &NarrowPhase,
stack: &mut Vec<ColliderHandle>,
) {
for collider_handle in &rb.colliders {
- let collider = &colliders[*collider_handle];
-
- for inter in contact_graph.interactions_with(collider.contact_graph_index) {
- for manifold in &inter.2.manifolds {
- if manifold.num_active_contacts() > 0 {
- let other =
- crate::utils::other_handle((inter.0, inter.1), *collider_handle);
- let other_body = colliders[other].parent;
- stack.push(other_body);
- break;
+ if let Some(contacts) = narrow_phase.contacts_with(*collider_handle) {
+ for inter in contacts {
+ for manifold in &inter.2.manifolds {
+ if manifold.num_active_contacts() > 0 {
+ let other = crate::utils::other_handle(
+ (inter.0, inter.1),
+ *collider_handle,
+ );
+ let other_body = colliders[other].parent;
+ stack.push(other_body);
+ break;
+ }
}
}
}
@@ -522,7 +524,7 @@ impl RigidBodySet {
continue;
}
- push_contacting_colliders(rb, colliders, contact_graph, &mut self.stack);
+ push_contacting_colliders(rb, colliders, narrow_phase, &mut self.stack);
}
// println!("Selection: {}", instant::now() - t);
@@ -565,7 +567,7 @@ impl RigidBodySet {
// Transmit the active state to all the rigid-bodies with colliders
// in contact or joined with this collider.
- push_contacting_colliders(rb, colliders, contact_graph, &mut self.stack);
+ push_contacting_colliders(rb, colliders, narrow_phase, &mut self.stack);
for inter in joint_graph.interactions_with(rb.joint_graph_index) {
let other = crate::utils::other_handle((inter.0, inter.1), handle);