From 01af6c09a786ec2d6475531a7dac873eeffa3a3e Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Mon, 2 Nov 2020 15:07:50 +0100 Subject: Fix simulation reaching different states when started from different snaphots. --- src/geometry/contact.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/geometry/contact.rs') 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, #[cfg_attr(feature = "serde-serialize", serde(skip))] pub(crate) generator: Option, - #[cfg_attr(feature = "serde-serialize", serde(skip))] - pub(crate) generator_workspace: Option>, + pub(crate) generator_workspace: Option, } impl ContactPair { pub(crate) fn new( pair: ColliderPair, generator: ContactPhase, - generator_workspace: Option>, + generator_workspace: Option, ) -> 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), ) } } -- cgit