diff options
| author | Thierry Berger <contact@thierryberger.com> | 2024-09-23 18:15:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 18:15:29 +0200 |
| commit | 9e1113c5c7e3c3a042bc5979c158e752acfeb46a (patch) | |
| tree | f5d41dce0ba5fa6f83d5e1fcde331a2294229e5d /src | |
| parent | 76357e3588dfc5efe9fa609df21e2aaf707fbba9 (diff) | |
| download | rapier-9e1113c5c7e3c3a042bc5979c158e752acfeb46a.tar.gz rapier-9e1113c5c7e3c3a042bc5979c158e752acfeb46a.tar.bz2 rapier-9e1113c5c7e3c3a042bc5979c158e752acfeb46a.zip | |
fix compilation for feature enhanced-determinism (#739)
Diffstat (limited to 'src')
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs | 7 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/sap_layer.rs | 3 | ||||
| -rw-r--r-- | src/pipeline/physics_pipeline.rs | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs b/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs index 78b00b9..cd5ac28 100644 --- a/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs +++ b/src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs @@ -231,7 +231,12 @@ impl BroadPhaseMultiSap { * Actually remove the colliders proxies. */ for removed in removed_colliders { - if let Some(proxy_id) = self.colliders_proxy_ids.remove(removed) { + #[cfg(feature = "enhanced-determinism")] + let proxy_id = self.colliders_proxy_ids.swap_remove(removed); + #[cfg(not(feature = "enhanced-determinism"))] + let proxy_id = self.colliders_proxy_ids.remove(removed); + + if let Some(proxy_id) = proxy_id { if proxy_id != crate::INVALID_U32 { self.proxies.remove(proxy_id); } diff --git a/src/geometry/broad_phase_multi_sap/sap_layer.rs b/src/geometry/broad_phase_multi_sap/sap_layer.rs index 241f8d2..2620798 100644 --- a/src/geometry/broad_phase_multi_sap/sap_layer.rs +++ b/src/geometry/broad_phase_multi_sap/sap_layer.rs @@ -356,6 +356,9 @@ impl SAPLayer { // Check if we can actually delete this region. if !region.contains_subproper_proxies() { + #[cfg(feature = "enhanced-determinism")] + let region_id = region_id.swap_remove(); + #[cfg(not(feature = "enhanced-determinism"))] let region_id = region_id.remove(); // We can delete this region. So we need to tell the larger diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index ab4b119..8505618 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -426,11 +426,17 @@ impl PhysicsPipeline { // Apply some of delayed wake-ups. self.counters.stages.user_changes.start(); - for handle in impulse_joints + #[cfg(feature = "enhanced-determinism")] + let impulse_joints_iterator = impulse_joints + .to_wake_up + .drain(..) + .chain(multibody_joints.to_wake_up.drain(..)); + #[cfg(not(feature = "enhanced-determinism"))] + let impulse_joints_iterator = impulse_joints .to_wake_up .drain() - .chain(multibody_joints.to_wake_up.drain()) - { + .chain(multibody_joints.to_wake_up.drain()); + for handle in impulse_joints_iterator { islands.wake_up(bodies, handle.0, true); } |
