@@ -1,4 +1,4 @@
|
||||
use parry::utils::hashmap::HashMap;
|
||||
use parry::utils::hashset::HashSet;
|
||||
|
||||
use super::ImpulseJoint;
|
||||
use crate::geometry::{InteractionGraph, RigidBodyGraphIndex, TemporaryInteractionIndex};
|
||||
@@ -46,7 +46,7 @@ pub struct ImpulseJointSet {
|
||||
joint_ids: Arena<TemporaryInteractionIndex>,
|
||||
joint_graph: InteractionGraph<RigidBodyHandle, ImpulseJoint>,
|
||||
/// A set of rigid-body handles to wake-up during the next timestep.
|
||||
pub(crate) to_wake_up: HashMap<RigidBodyHandle, ()>,
|
||||
pub(crate) to_wake_up: HashSet<RigidBodyHandle>,
|
||||
}
|
||||
|
||||
impl ImpulseJointSet {
|
||||
@@ -56,7 +56,7 @@ impl ImpulseJointSet {
|
||||
rb_graph_ids: Coarena::new(),
|
||||
joint_ids: Arena::new(),
|
||||
joint_graph: InteractionGraph::new(),
|
||||
to_wake_up: HashMap::default(),
|
||||
to_wake_up: HashSet::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ impl ImpulseJointSet {
|
||||
let joint = self.joint_graph.graph.edge_weight_mut(*id);
|
||||
if wake_up_connected_bodies {
|
||||
if let Some(joint) = &joint {
|
||||
self.to_wake_up.insert(joint.body1, ());
|
||||
self.to_wake_up.insert(joint.body2, ());
|
||||
self.to_wake_up.insert(joint.body1);
|
||||
self.to_wake_up.insert(joint.body2);
|
||||
}
|
||||
}
|
||||
joint
|
||||
@@ -285,8 +285,8 @@ impl ImpulseJointSet {
|
||||
self.joint_ids[handle] = self.joint_graph.add_edge(graph_index1, graph_index2, joint);
|
||||
|
||||
if wake_up {
|
||||
self.to_wake_up.insert(body1, ());
|
||||
self.to_wake_up.insert(body2, ());
|
||||
self.to_wake_up.insert(body1);
|
||||
self.to_wake_up.insert(body2);
|
||||
}
|
||||
|
||||
ImpulseJointHandle(handle)
|
||||
@@ -337,10 +337,10 @@ impl ImpulseJointSet {
|
||||
|
||||
if wake_up {
|
||||
if let Some(rb_handle) = self.joint_graph.graph.node_weight(endpoints.0) {
|
||||
self.to_wake_up.insert(*rb_handle, ());
|
||||
self.to_wake_up.insert(*rb_handle);
|
||||
}
|
||||
if let Some(rb_handle) = self.joint_graph.graph.node_weight(endpoints.1) {
|
||||
self.to_wake_up.insert(*rb_handle, ());
|
||||
self.to_wake_up.insert(*rb_handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,8 +390,8 @@ impl ImpulseJointSet {
|
||||
}
|
||||
|
||||
// Wake up the attached bodies.
|
||||
self.to_wake_up.insert(h1, ());
|
||||
self.to_wake_up.insert(h2, ());
|
||||
self.to_wake_up.insert(h1);
|
||||
self.to_wake_up.insert(h2);
|
||||
}
|
||||
|
||||
if let Some(other) = self.joint_graph.remove_node(deleted_id) {
|
||||
|
||||
Reference in New Issue
Block a user