From 036a24614171eff0f99495b8b6f1c09e58cb4f9a Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 14:29:47 +0100 Subject: Make cloning rigid-bodies and colliders more idiomatic. Fix #53 --- src/data/graph.rs | 10 +--------- src/dynamics/joint/joint.rs | 1 + src/dynamics/rigid_body.rs | 25 ++++++++++--------------- src/dynamics/rigid_body_set.rs | 6 +++++- src/geometry/collider.rs | 19 +++++++------------ src/geometry/collider_set.rs | 4 ++++ 6 files changed, 28 insertions(+), 37 deletions(-) diff --git a/src/data/graph.rs b/src/data/graph.rs index ea27e03..de958c3 100644 --- a/src/data/graph.rs +++ b/src/data/graph.rs @@ -749,20 +749,12 @@ impl IndexMut for Graph { /// The walker does not borrow from the graph, so it lets you step through /// neighbors or incident edges while also mutating graph weights, as /// in the following example: +#[derive(Clone)] pub struct WalkNeighbors { skip_start: NodeIndex, next: [EdgeIndex; 2], } -impl Clone for WalkNeighbors { - fn clone(&self) -> Self { - WalkNeighbors { - skip_start: self.skip_start, - next: self.next, - } - } -} - /// Reference to a `Graph` edge. #[derive(Debug)] pub struct EdgeReference<'a, E: 'a> { diff --git a/src/dynamics/joint/joint.rs b/src/dynamics/joint/joint.rs index 074f802..9fe6488 100644 --- a/src/dynamics/joint/joint.rs +++ b/src/dynamics/joint/joint.rs @@ -95,6 +95,7 @@ impl From for JointParams { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] /// A joint attached to two bodies. pub struct Joint { /// Handle to the first body attached to this joint. diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 6b897a6..b04ca41 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -27,7 +27,7 @@ pub enum BodyStatus { /// A rigid body. /// /// To create a new rigid-body, use the `RigidBodyBuilder` structure. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct RigidBody { /// The world-space position of the rigid-body. pub position: Isometry, @@ -58,20 +58,6 @@ pub struct RigidBody { pub user_data: u128, } -impl Clone for RigidBody { - fn clone(&self) -> Self { - Self { - colliders: Vec::new(), - joint_graph_index: RigidBodyGraphIndex::new(crate::INVALID_U32), - active_island_id: crate::INVALID_USIZE, - active_set_id: crate::INVALID_USIZE, - active_set_offset: crate::INVALID_USIZE, - active_set_timestamp: crate::INVALID_U32, - ..*self - } - } -} - impl RigidBody { fn new() -> Self { Self { @@ -96,6 +82,15 @@ impl RigidBody { } } + pub(crate) fn reset_internal_links(&mut self) { + self.colliders = Vec::new(); + self.joint_graph_index = RigidBodyGraphIndex::new(crate::INVALID_U32); + self.active_island_id = crate::INVALID_USIZE; + self.active_set_id = crate::INVALID_USIZE; + self.active_set_offset = crate::INVALID_USIZE; + self.active_set_timestamp = crate::INVALID_U32; + } + pub(crate) fn integrate_accelerations(&mut self, dt: f32, gravity: Vector) { if self.mass_properties.inv_mass != 0.0 { self.linvel += (gravity + self.linacc) * dt; diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs index 83f1c51..2efc2cf 100644 --- a/src/dynamics/rigid_body_set.rs +++ b/src/dynamics/rigid_body_set.rs @@ -154,7 +154,11 @@ impl RigidBodySet { } /// Insert a rigid body into this set and retrieve its handle. - pub fn insert(&mut self, rb: RigidBody) -> RigidBodyHandle { + pub fn insert(&mut self, mut rb: RigidBody) -> RigidBodyHandle { + // Make sure the internal links are reset, they may not be + // if this rigid-body was obtained by cloning another one. + rb.reset_internal_links(); + let handle = self.bodies.insert(rb); let rb = &mut self.bodies[handle]; diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index f53d75a..524f265 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -188,6 +188,7 @@ impl<'de> serde::Deserialize<'de> for ColliderShape { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] /// A geometric entity that can be attached to a body so it can be affected by contacts and proximity queries. /// /// To build a new collider, use the `ColliderBuilder` structure. @@ -212,20 +213,14 @@ pub struct Collider { pub user_data: u128, } -impl Clone for Collider { - fn clone(&self) -> Self { - Self { - shape: self.shape.clone(), - parent: RigidBodySet::invalid_handle(), - contact_graph_index: ColliderGraphIndex::new(crate::INVALID_U32), - proximity_graph_index: ColliderGraphIndex::new(crate::INVALID_U32), - proxy_index: crate::INVALID_USIZE, - ..*self - } +impl Collider { + pub(crate) fn reset_internal_links(&mut self) { + self.parent = RigidBodySet::invalid_handle(); + self.contact_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); + self.proximity_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); + self.proxy_index = crate::INVALID_USIZE; } -} -impl Collider { /// The rigid body this collider is attached to. pub fn parent(&self) -> RigidBodyHandle { self.parent diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs index 5ac9658..d2bb8cc 100644 --- a/src/geometry/collider_set.rs +++ b/src/geometry/collider_set.rs @@ -59,6 +59,10 @@ impl ColliderSet { parent_handle: RigidBodyHandle, bodies: &mut RigidBodySet, ) -> ColliderHandle { + // Make sure the internal links are reset, they may not be + // if this rigid-body was obtained by cloning another one. + coll.reset_internal_links(); + coll.parent = parent_handle; let parent = bodies .get_mut_internal(parent_handle) -- cgit From 0cf59d78bda1669226f861e438d43a08b099d747 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 14:43:21 +0100 Subject: Implement Clone for everything that can be cloned. --- src/data/maybe_serializable_data.rs | 3 +++ src/data/pubsub.rs | 3 +++ src/dynamics/rigid_body_set.rs | 1 + src/geometry/broad_phase_multi_sap.rs | 5 +++++ src/geometry/collider_set.rs | 1 + src/geometry/contact.rs | 1 + .../contact_generator/contact_generator_workspace.rs | 6 ++++++ .../contact_generator/heightfield_shape_contact_generator.rs | 6 ++++++ src/geometry/contact_generator/pfm_pfm_contact_generator.rs | 5 +++++ .../contact_generator/trimesh_shape_contact_generator.rs | 5 +++++ src/geometry/interaction_graph.rs | 1 + src/geometry/narrow_phase.rs | 1 + src/geometry/proximity.rs | 12 ++++++++++++ src/pipeline/query_pipeline.rs | 1 + 14 files changed, 51 insertions(+) diff --git a/src/data/maybe_serializable_data.rs b/src/data/maybe_serializable_data.rs index db38963..8b14e1a 100644 --- a/src/data/maybe_serializable_data.rs +++ b/src/data/maybe_serializable_data.rs @@ -9,6 +9,9 @@ pub trait MaybeSerializableData: DowncastSync { fn as_serialize(&self) -> Option<(u32, &dyn Serialize)> { None } + + /// Clones `self`. + fn clone_dyn(&self) -> Box; } impl_downcast!(sync MaybeSerializableData); diff --git a/src/data/pubsub.rs b/src/data/pubsub.rs index b2c9e27..80fb3a2 100644 --- a/src/data/pubsub.rs +++ b/src/data/pubsub.rs @@ -5,6 +5,7 @@ use std::marker::PhantomData; /// A permanent subscription to a pub-sub queue. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct Subscription { // Position on the cursor array. id: u32, @@ -12,6 +13,7 @@ pub struct Subscription { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] struct PubSubCursor { // Position on the offset array. id: u32, @@ -36,6 +38,7 @@ impl PubSubCursor { /// A pub-sub queue. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct PubSub { deleted_messages: u32, deleted_offsets: u32, diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs index 2efc2cf..f7064ed 100644 --- a/src/dynamics/rigid_body_set.rs +++ b/src/dynamics/rigid_body_set.rs @@ -75,6 +75,7 @@ impl BodyPair { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] /// A set of rigid bodies that can be handled by a physics pipeline. pub struct RigidBodySet { // NOTE: the pub(crate) are needed by the broad phase diff --git a/src/geometry/broad_phase_multi_sap.rs b/src/geometry/broad_phase_multi_sap.rs index 1afda5a..21413ef 100644 --- a/src/geometry/broad_phase_multi_sap.rs +++ b/src/geometry/broad_phase_multi_sap.rs @@ -132,6 +132,7 @@ impl Endpoint { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] struct SAPAxis { min_bound: f32, max_bound: f32, @@ -331,6 +332,7 @@ impl SAPAxis { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] struct SAPRegion { axes: [SAPAxis; DIM], existing_proxies: BitVec, @@ -411,6 +413,7 @@ impl SAPRegion { /// A broad-phase based on multiple Sweep-and-Prune instances running of disjoint region of the 3D world. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct BroadPhase { proxies: Proxies, regions: HashMap, SAPRegion>, @@ -438,6 +441,7 @@ pub struct BroadPhase { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub(crate) struct BroadPhaseProxy { handle: ColliderHandle, aabb: AABB, @@ -445,6 +449,7 @@ pub(crate) struct BroadPhaseProxy { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] struct Proxies { elements: Vec, first_free: u32, diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs index d2bb8cc..0ba5911 100644 --- a/src/geometry/collider_set.rs +++ b/src/geometry/collider_set.rs @@ -17,6 +17,7 @@ pub(crate) struct RemovedCollider { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] /// A set of colliders that can be handled by a physics `World`. pub struct ColliderSet { pub(crate) removed_colliders: PubSub, diff --git a/src/geometry/contact.rs b/src/geometry/contact.rs index 53e9064..a4a176e 100644 --- a/src/geometry/contact.rs +++ b/src/geometry/contact.rs @@ -172,6 +172,7 @@ impl Contact { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] /// The description of all the contacts between a pair of colliders. pub struct ContactPair { /// The pair of colliders involved. diff --git a/src/geometry/contact_generator/contact_generator_workspace.rs b/src/geometry/contact_generator/contact_generator_workspace.rs index fb6d7b4..e89395f 100644 --- a/src/geometry/contact_generator/contact_generator_workspace.rs +++ b/src/geometry/contact_generator/contact_generator_workspace.rs @@ -9,6 +9,12 @@ use crate::geometry::contact_generator::{ // Note we have this newtype because it simplifies the serialization/deserialization code. pub struct ContactGeneratorWorkspace(pub Box); +impl Clone for ContactGeneratorWorkspace { + fn clone(&self) -> Self { + ContactGeneratorWorkspace(self.0.clone_dyn()) + } +} + impl From for ContactGeneratorWorkspace { fn from(data: T) -> Self { Self(Box::new(data) as Box) diff --git a/src/geometry/contact_generator/heightfield_shape_contact_generator.rs b/src/geometry/contact_generator/heightfield_shape_contact_generator.rs index 62c6365..70360c9 100644 --- a/src/geometry/contact_generator/heightfield_shape_contact_generator.rs +++ b/src/geometry/contact_generator/heightfield_shape_contact_generator.rs @@ -12,6 +12,7 @@ use crate::ncollide::bounding_volume::BoundingVolume; use erased_serde::Serialize; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] struct SubDetector { #[cfg_attr(feature = "serde-serialize", serde(skip))] generator: Option, @@ -21,6 +22,7 @@ struct SubDetector { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct HeightFieldShapeContactGeneratorWorkspace { timestamp: bool, #[cfg_attr(feature = "serde-serialize", serde(skip))] @@ -182,4 +184,8 @@ impl MaybeSerializableData for HeightFieldShapeContactGeneratorWorkspace { self, )) } + + fn clone_dyn(&self) -> Box { + Box::new(self.clone()) + } } diff --git a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs index 027c398..e18e77f 100644 --- a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs +++ b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs @@ -9,6 +9,7 @@ use ncollide::query; use ncollide::query::algorithms::{gjk::GJKResult, VoronoiSimplex}; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct PfmPfmContactManifoldGeneratorWorkspace { #[cfg_attr( feature = "serde-serialize", @@ -136,4 +137,8 @@ impl MaybeSerializableData for PfmPfmContactManifoldGeneratorWorkspace { self, )) } + + fn clone(&self) -> Box { + Box::new(self.clone()) + } } diff --git a/src/geometry/contact_generator/trimesh_shape_contact_generator.rs b/src/geometry/contact_generator/trimesh_shape_contact_generator.rs index 26ccfaa..3f7d7cd 100644 --- a/src/geometry/contact_generator/trimesh_shape_contact_generator.rs +++ b/src/geometry/contact_generator/trimesh_shape_contact_generator.rs @@ -8,6 +8,7 @@ use crate::ncollide::bounding_volume::{BoundingVolume, AABB}; use erased_serde::Serialize; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct TrimeshShapeContactGeneratorWorkspace { interferences: Vec, local_aabb2: AABB, @@ -213,4 +214,8 @@ impl MaybeSerializableData for TrimeshShapeContactGeneratorWorkspace { self, )) } + + fn clone_dyn(&self) -> Box { + Box::new(self.clone()) + } } diff --git a/src/geometry/interaction_graph.rs b/src/geometry/interaction_graph.rs index c0cf093..2abb6d1 100644 --- a/src/geometry/interaction_graph.rs +++ b/src/geometry/interaction_graph.rs @@ -10,6 +10,7 @@ pub type TemporaryInteractionIndex = EdgeIndex; /// A graph where nodes are collision objects and edges are contact or proximity algorithms. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct InteractionGraph { pub(crate) graph: Graph, } diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index e3e52e5..059a640 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -29,6 +29,7 @@ use std::collections::HashMap; /// The narrow-phase responsible for computing precise contact information between colliders. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct NarrowPhase { contact_graph: InteractionGraph, proximity_graph: InteractionGraph, diff --git a/src/geometry/proximity.rs b/src/geometry/proximity.rs index 88e6e76..d3e0dc4 100644 --- a/src/geometry/proximity.rs +++ b/src/geometry/proximity.rs @@ -15,6 +15,18 @@ pub struct ProximityPair { pub(crate) detector_workspace: Option>, } +// TODO: use the `derive(Clone)` instead? +impl Clone for ProximityPair { + fn clone(&self) -> Self { + ProximityPair { + pair: self.pair.clone(), + proximity: self.proximity.clone(), + detector: None, + detector_workspace: None, + } + } +} + impl ProximityPair { pub(crate) fn new( pair: ColliderPair, diff --git a/src/pipeline/query_pipeline.rs b/src/pipeline/query_pipeline.rs index 00d4396..c21574a 100644 --- a/src/pipeline/query_pipeline.rs +++ b/src/pipeline/query_pipeline.rs @@ -5,6 +5,7 @@ use crate::geometry::{ /// A pipeline for performing queries on all the colliders of a scene. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone)] pub struct QueryPipeline { quadtree: WQuadtree, tree_built: bool, -- cgit From c6af248e66c86c900d7703bcefeb1e6d185ffedf Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 14:45:50 +0100 Subject: Rename reset_internal_links -> reset_internal_references. --- src/dynamics/rigid_body.rs | 2 +- src/dynamics/rigid_body_set.rs | 2 +- src/geometry/collider.rs | 2 +- src/geometry/collider_set.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index b04ca41..f85ab89 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -82,7 +82,7 @@ impl RigidBody { } } - pub(crate) fn reset_internal_links(&mut self) { + pub(crate) fn reset_internal_references(&mut self) { self.colliders = Vec::new(); self.joint_graph_index = RigidBodyGraphIndex::new(crate::INVALID_U32); self.active_island_id = crate::INVALID_USIZE; diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs index f7064ed..b857173 100644 --- a/src/dynamics/rigid_body_set.rs +++ b/src/dynamics/rigid_body_set.rs @@ -158,7 +158,7 @@ impl RigidBodySet { pub fn insert(&mut self, mut rb: RigidBody) -> RigidBodyHandle { // Make sure the internal links are reset, they may not be // if this rigid-body was obtained by cloning another one. - rb.reset_internal_links(); + rb.reset_internal_references(); let handle = self.bodies.insert(rb); let rb = &mut self.bodies[handle]; diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index 524f265..f7f4efa 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -214,7 +214,7 @@ pub struct Collider { } impl Collider { - pub(crate) fn reset_internal_links(&mut self) { + pub(crate) fn reset_internal_references(&mut self) { self.parent = RigidBodySet::invalid_handle(); self.contact_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); self.proximity_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs index 0ba5911..fd94675 100644 --- a/src/geometry/collider_set.rs +++ b/src/geometry/collider_set.rs @@ -62,7 +62,7 @@ impl ColliderSet { ) -> ColliderHandle { // Make sure the internal links are reset, they may not be // if this rigid-body was obtained by cloning another one. - coll.reset_internal_links(); + coll.reset_internal_references(); coll.parent = parent_handle; let parent = bodies -- cgit From 477411c6564d170c7287693c7f03976ece822c23 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 14:50:29 +0100 Subject: Fix 3D compilation. --- src/geometry/contact_generator/pfm_pfm_contact_generator.rs | 2 +- src/geometry/polyhedron_feature3d.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs index e18e77f..a9906cb 100644 --- a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs +++ b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs @@ -138,7 +138,7 @@ impl MaybeSerializableData for PfmPfmContactManifoldGeneratorWorkspace { )) } - fn clone(&self) -> Box { + fn clone_dyn(&self) -> Box { Box::new(self.clone()) } } diff --git a/src/geometry/polyhedron_feature3d.rs b/src/geometry/polyhedron_feature3d.rs index d7f0a23..5ad62df 100644 --- a/src/geometry/polyhedron_feature3d.rs +++ b/src/geometry/polyhedron_feature3d.rs @@ -5,7 +5,7 @@ use crate::utils::WBasis; use na::Point2; use ncollide::shape::Segment; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct PolyhedronFace { pub vertices: [Point; 4], pub vids: [u8; 4], // Feature ID of the vertices. -- cgit From 71611d3e30ce2fddee20832db3c3e0c8b6ba0d07 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 15:08:06 +0100 Subject: Reset the rigid-bodies internal links properly. --- src/dynamics/rigid_body.rs | 10 +++++----- src/geometry/collider.rs | 4 ++-- src/geometry/contact_generator/pfm_pfm_contact_generator.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index f85ab89..d3bd8d7 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -84,11 +84,11 @@ impl RigidBody { pub(crate) fn reset_internal_references(&mut self) { self.colliders = Vec::new(); - self.joint_graph_index = RigidBodyGraphIndex::new(crate::INVALID_U32); - self.active_island_id = crate::INVALID_USIZE; - self.active_set_id = crate::INVALID_USIZE; - self.active_set_offset = crate::INVALID_USIZE; - self.active_set_timestamp = crate::INVALID_U32; + self.joint_graph_index = InteractionGraph::<()>::invalid_graph_index(); + self.active_island_id = 0; + self.active_set_id = 0; + self.active_set_offset = 0; + self.active_set_timestamp = 0; } pub(crate) fn integrate_accelerations(&mut self, dt: f32, gravity: Vector) { diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index f7f4efa..c2adc59 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -216,8 +216,8 @@ pub struct Collider { impl Collider { pub(crate) fn reset_internal_references(&mut self) { self.parent = RigidBodySet::invalid_handle(); - self.contact_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); - self.proximity_graph_index = ColliderGraphIndex::new(crate::INVALID_U32); + self.contact_graph_index = InteractionGraph::::invalid_graph_index(); + self.proximity_graph_index = InteractionGraph::::invalid_graph_index(); self.proxy_index = crate::INVALID_USIZE; } diff --git a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs index a9906cb..5bc213e 100644 --- a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs +++ b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs @@ -138,7 +138,7 @@ impl MaybeSerializableData for PfmPfmContactManifoldGeneratorWorkspace { )) } - fn clone_dyn(&self) -> Box { + fn clone_dyn(&self) -> Box { Box::new(self.clone()) } } -- cgit