aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/joint/impulse_joint
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-06-23 16:23:39 +0200
committerSébastien Crozet <developer@crozet.re>2022-07-03 13:55:41 +0200
commit5063f3bb4fec2716f78a208552ee260f22428840 (patch)
treeb5665abb9c97469354c8c4dfd1a3fca21057ce16 /src/dynamics/joint/impulse_joint
parentcd0be8c076c69b88bb1848de72228225eeccb52d (diff)
downloadrapier-5063f3bb4fec2716f78a208552ee260f22428840.tar.gz
rapier-5063f3bb4fec2716f78a208552ee260f22428840.tar.bz2
rapier-5063f3bb4fec2716f78a208552ee260f22428840.zip
Add the ability to disable contacts between two rigid-bodies attached by joints
Diffstat (limited to 'src/dynamics/joint/impulse_joint')
-rw-r--r--src/dynamics/joint/impulse_joint/impulse_joint_set.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dynamics/joint/impulse_joint/impulse_joint_set.rs b/src/dynamics/joint/impulse_joint/impulse_joint_set.rs
index c4ec734..7409172 100644
--- a/src/dynamics/joint/impulse_joint/impulse_joint_set.rs
+++ b/src/dynamics/joint/impulse_joint/impulse_joint_set.rs
@@ -71,6 +71,20 @@ impl ImpulseJointSet {
&self.joint_graph
}
+ /// Iterates through all the joints between two rigid-bodies.
+ pub fn joints_between<'a>(
+ &'a self,
+ body1: RigidBodyHandle,
+ body2: RigidBodyHandle,
+ ) -> impl Iterator<Item = (ImpulseJointHandle, &'a ImpulseJoint)> {
+ self.rb_graph_ids
+ .get(body1.0)
+ .zip(self.rb_graph_ids.get(body2.0))
+ .into_iter()
+ .flat_map(move |(id1, id2)| self.joint_graph.interaction_pair(*id1, *id2).into_iter())
+ .map(|inter| (inter.2.handle, inter.2))
+ }
+
/// Iterates through all the impulse joints attached to the given rigid-body.
pub fn attached_joints<'a>(
&'a self,