diff options
| author | Sébastien Crozet <developer@crozet.re> | 2021-05-01 10:17:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-01 10:17:23 +0200 |
| commit | a385efc5582c7918f11c01a2b6bf26a46919d3a0 (patch) | |
| tree | c5b9c5e6fcb5561421e2b4b9d99f28e4c83c745e /src/dynamics/solver/categorization.rs | |
| parent | aaf80bfa872c6f29b248cab8eb5658ab0d73cb4a (diff) | |
| parent | 2dfbd9ae92c139e306afc87994adac82489f30eb (diff) | |
| download | rapier-a385efc5582c7918f11c01a2b6bf26a46919d3a0.tar.gz rapier-a385efc5582c7918f11c01a2b6bf26a46919d3a0.tar.bz2 rapier-a385efc5582c7918f11c01a2b6bf26a46919d3a0.zip | |
Merge pull request #183 from dimforge/bundles
Make Rapier accept any kind of data storage instead of RigidBodySet/ColliderSet
Diffstat (limited to 'src/dynamics/solver/categorization.rs')
| -rw-r--r-- | src/dynamics/solver/categorization.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dynamics/solver/categorization.rs b/src/dynamics/solver/categorization.rs index e3327c6..366a5b3 100644 --- a/src/dynamics/solver/categorization.rs +++ b/src/dynamics/solver/categorization.rs @@ -1,8 +1,9 @@ -use crate::dynamics::{JointGraphEdge, JointIndex, RigidBodySet}; +use crate::data::ComponentSet; +use crate::dynamics::{JointGraphEdge, JointIndex, RigidBodyType}; use crate::geometry::{ContactManifold, ContactManifoldIndex}; pub(crate) fn categorize_contacts( - _bodies: &RigidBodySet, // Unused but useful to simplify the parallel code. + _bodies: &impl ComponentSet<RigidBodyType>, // Unused but useful to simplify the parallel code. manifolds: &[&mut ContactManifold], manifold_indices: &[ContactManifoldIndex], out_ground: &mut Vec<ContactManifoldIndex>, @@ -20,7 +21,7 @@ pub(crate) fn categorize_contacts( } pub(crate) fn categorize_joints( - bodies: &RigidBodySet, + bodies: &impl ComponentSet<RigidBodyType>, joints: &[JointGraphEdge], joint_indices: &[JointIndex], ground_joints: &mut Vec<JointIndex>, @@ -28,10 +29,10 @@ pub(crate) fn categorize_joints( ) { for joint_i in joint_indices { let joint = &joints[*joint_i].weight; - let rb1 = &bodies[joint.body1]; - let rb2 = &bodies[joint.body2]; + let status1 = bodies.index(joint.body1.0); + let status2 = bodies.index(joint.body2.0); - if !rb1.is_dynamic() || !rb2.is_dynamic() { + if !status1.is_dynamic() || !status2.is_dynamic() { ground_joints.push(*joint_i); } else { nonground_joints.push(*joint_i); |
