diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-01-02 17:43:38 +0100 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2022-01-02 17:43:38 +0100 |
| commit | 9f9d3293605fa84555c08bec5efe68a71cd18432 (patch) | |
| tree | ccbaf613fa2bb37487015bfe51e6918bd2ca8c39 | |
| parent | 90edb4b53242fc24ecb666bebc593638ee0ff7fe (diff) | |
| download | rapier-9f9d3293605fa84555c08bec5efe68a71cd18432.tar.gz rapier-9f9d3293605fa84555c08bec5efe68a71cd18432.tar.bz2 rapier-9f9d3293605fa84555c08bec5efe68a71cd18432.zip | |
Fix tests
| -rw-r--r-- | benchmarks2d/joint_prismatic2.rs | 2 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/broad_phase.rs | 13 | ||||
| -rw-r--r-- | src/pipeline/physics_pipeline.rs | 48 |
3 files changed, 55 insertions, 8 deletions
diff --git a/benchmarks2d/joint_prismatic2.rs b/benchmarks2d/joint_prismatic2.rs index 4733088..20d423e 100644 --- a/benchmarks2d/joint_prismatic2.rs +++ b/benchmarks2d/joint_prismatic2.rs @@ -47,7 +47,7 @@ pub fn init_world(testbed: &mut Testbed) { UnitVector::new_normalize(vector![-1.0, 1.0]) }; - let mut prism = PrismaticJoint::new(axis) + let prism = PrismaticJoint::new(axis) .local_anchor2(point![0.0, shift]) .limit_axis([-1.5, 1.5]); impulse_joints.insert(curr_parent, curr_child, prism); diff --git a/src/geometry/broad_phase_multi_sap/broad_phase.rs b/src/geometry/broad_phase_multi_sap/broad_phase.rs index 8f1d310..d2b0076 100644 --- a/src/geometry/broad_phase_multi_sap/broad_phase.rs +++ b/src/geometry/broad_phase_multi_sap/broad_phase.rs @@ -620,7 +620,9 @@ impl BroadPhase { #[cfg(test)] mod test { - use crate::dynamics::{ImpulseJointSet, IslandManager, RigidBodyBuilder, RigidBodySet}; + use crate::dynamics::{ + ImpulseJointSet, IslandManager, MultibodyJointSet, RigidBodyBuilder, RigidBodySet, + }; use crate::geometry::{BroadPhase, ColliderBuilder, ColliderSet}; #[test] @@ -629,6 +631,7 @@ mod test { let mut bodies = RigidBodySet::new(); let mut colliders = ColliderSet::new(); let mut impulse_joints = ImpulseJointSet::new(); + let mut multibody_joints = MultibodyJointSet::new(); let mut islands = IslandManager::new(); let rb = RigidBodyBuilder::new_dynamic().build(); @@ -639,7 +642,13 @@ mod test { let mut events = Vec::new(); broad_phase.update(0.0, &mut colliders, &[coh], &[], &mut events); - bodies.remove(hrb, &mut islands, &mut colliders, &mut impulse_joints); + bodies.remove( + hrb, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); broad_phase.update(0.0, &mut colliders, &[], &[coh], &mut events); // Create another body. diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index b244860..a289a09 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -706,11 +706,13 @@ mod test { use crate::geometry::{BroadPhase, ColliderBuilder, ColliderSet, NarrowPhase}; use crate::math::Vector; use crate::pipeline::PhysicsPipeline; + use crate::prelude::MultibodyJointSet; #[test] fn kinematic_and_static_contact_crash() { let mut colliders = ColliderSet::new(); let mut impulse_joints = ImpulseJointSet::new(); + let mut multibody_joints = MultibodyJointSet::new(); let mut pipeline = PhysicsPipeline::new(); let mut bf = BroadPhase::new(); let mut nf = NarrowPhase::new(); @@ -736,6 +738,7 @@ mod test { &mut bodies, &mut colliders, &mut impulse_joints, + &mut multibody_joints, &mut CCDSolver::new(), &(), &(), @@ -746,6 +749,7 @@ mod test { fn rigid_body_removal_before_step() { let mut colliders = ColliderSet::new(); let mut impulse_joints = ImpulseJointSet::new(); + let mut multibody_joints = MultibodyJointSet::new(); let mut pipeline = PhysicsPipeline::new(); let mut bf = BroadPhase::new(); let mut nf = NarrowPhase::new(); @@ -770,7 +774,13 @@ mod test { let to_delete = [h1, h2, h3, h4]; for h in &to_delete { - bodies.remove(*h, &mut islands, &mut colliders, &mut impulse_joints); + bodies.remove( + *h, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); } pipeline.step( @@ -782,6 +792,7 @@ mod test { &mut bodies, &mut colliders, &mut impulse_joints, + &mut multibody_joints, &mut CCDSolver::new(), &(), &(), @@ -793,6 +804,7 @@ mod test { fn rigid_body_removal_snapshot_handle_determinism() { let mut colliders = ColliderSet::new(); let mut impulse_joints = ImpulseJointSet::new(); + let mut multibody_joints = MultibodyJointSet::new(); let mut islands = IslandManager::new(); let mut bodies = RigidBodySet::new(); @@ -801,9 +813,27 @@ mod test { let h2 = bodies.insert(rb.clone()); let h3 = bodies.insert(rb.clone()); - bodies.remove(h1, &mut islands, &mut colliders, &mut impulse_joints); - bodies.remove(h3, &mut islands, &mut colliders, &mut impulse_joints); - bodies.remove(h2, &mut islands, &mut colliders, &mut impulse_joints); + bodies.remove( + h1, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); + bodies.remove( + h3, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); + bodies.remove( + h2, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); let ser_bodies = bincode::serialize(&bodies).unwrap(); let mut bodies2: RigidBodySet = bincode::deserialize(&ser_bodies).unwrap(); @@ -832,6 +862,7 @@ mod test { let mut colliders = ColliderSet::new(); let mut ccd = CCDSolver::new(); let mut impulse_joints = ImpulseJointSet::new(); + let mut multibody_joints = MultibodyJointSet::new(); let mut islands = IslandManager::new(); let physics_hooks = (); let event_handler = (); @@ -841,7 +872,13 @@ mod test { let collider = ColliderBuilder::ball(1.0).build(); let c_handle = colliders.insert_with_parent(collider, b_handle, &mut bodies); colliders.remove(c_handle, &mut islands, &mut bodies, true); - bodies.remove(b_handle, &mut islands, &mut colliders, &mut impulse_joints); + bodies.remove( + b_handle, + &mut islands, + &mut colliders, + &mut impulse_joints, + &mut multibody_joints, + ); for _ in 0..10 { pipeline.step( @@ -853,6 +890,7 @@ mod test { &mut bodies, &mut colliders, &mut impulse_joints, + &mut multibody_joints, &mut ccd, &physics_hooks, &event_handler, |
