diff options
| author | Sébastien Crozet <developer@crozet.re> | 2020-11-02 18:43:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 18:43:07 +0100 |
| commit | 9c72a0458b89741ce31744efa2d33f4b75de0d79 (patch) | |
| tree | 1da50d34e9342d99a6f15168862e9572b9127e6a /src/geometry/contact.rs | |
| parent | 4b8242b9c267a9412c88793575db37f79c544ca2 (diff) | |
| parent | 83482602717d1a9aebb181fb82456a292801cbdc (diff) | |
| download | rapier-9c72a0458b89741ce31744efa2d33f4b75de0d79.tar.gz rapier-9c72a0458b89741ce31744efa2d33f4b75de0d79.tar.bz2 rapier-9c72a0458b89741ce31744efa2d33f4b75de0d79.zip | |
Merge pull request #49 from dimforge/determinism_bug
Fix simulation reaching different states when started from different snaphots
Diffstat (limited to 'src/geometry/contact.rs')
| -rw-r--r-- | src/geometry/contact.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/geometry/contact.rs b/src/geometry/contact.rs index d8f3632..53e9064 100644 --- a/src/geometry/contact.rs +++ b/src/geometry/contact.rs @@ -1,8 +1,8 @@ +use crate::data::MaybeSerializableData; use crate::dynamics::BodyPair; -use crate::geometry::contact_generator::ContactPhase; +use crate::geometry::contact_generator::{ContactGeneratorWorkspace, ContactPhase}; use crate::geometry::{Collider, ColliderPair, ColliderSet}; use crate::math::{Isometry, Point, Vector}; -use std::any::Any; #[cfg(feature = "simd-is-enabled")] use { crate::math::{SimdFloat, SIMD_WIDTH}, @@ -182,15 +182,14 @@ pub struct ContactPair { pub manifolds: Vec<ContactManifold>, #[cfg_attr(feature = "serde-serialize", serde(skip))] pub(crate) generator: Option<ContactPhase>, - #[cfg_attr(feature = "serde-serialize", serde(skip))] - pub(crate) generator_workspace: Option<Box<dyn Any + Send + Sync>>, + pub(crate) generator_workspace: Option<ContactGeneratorWorkspace>, } impl ContactPair { pub(crate) fn new( pair: ColliderPair, generator: ContactPhase, - generator_workspace: Option<Box<dyn Any + Send + Sync>>, + generator_workspace: Option<ContactGeneratorWorkspace>, ) -> Self { Self { pair, @@ -221,7 +220,7 @@ impl ContactPair { &'b Collider, &'b Collider, &'a mut ContactManifold, - Option<&'a mut (dyn Any + Send + Sync)>, + Option<&'a mut (dyn MaybeSerializableData)>, ) { let coll1 = &colliders[self.pair.collider1]; let coll2 = &colliders[self.pair.collider2]; @@ -240,14 +239,14 @@ impl ContactPair { coll1, coll2, manifold, - self.generator_workspace.as_mut().map(|w| &mut **w), + self.generator_workspace.as_mut().map(|w| &mut *w.0), ) } else { ( coll2, coll1, manifold, - self.generator_workspace.as_mut().map(|w| &mut **w), + self.generator_workspace.as_mut().map(|w| &mut *w.0), ) } } |
