From e92f51f3bec6d1708ebeba94ab30524587d2ee5a Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sun, 21 Jul 2024 00:11:21 +0200 Subject: [PATCH 1/7] Change how interaction groups work to be or instead of and --- src/geometry/interaction_groups.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geometry/interaction_groups.rs b/src/geometry/interaction_groups.rs index d8941f752..672366897 100644 --- a/src/geometry/interaction_groups.rs +++ b/src/geometry/interaction_groups.rs @@ -13,7 +13,7 @@ /// /// In other words, interactions are allowed between two filter iff. the following condition is met: /// ```ignore -/// (self.memberships & rhs.filter) != 0 && (rhs.memberships & self.filter) != 0 +/// (self.memberships & rhs.filter) != 0 || (rhs.memberships & self.filter) != 0 /// ``` #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] @@ -65,7 +65,7 @@ impl InteractionGroups { // NOTE: since const ops is not stable, we have to convert `Group` into u32 // to use & operator in const context. (self.memberships.bits() & rhs.filter.bits()) != 0 - && (rhs.memberships.bits() & self.filter.bits()) != 0 + || (rhs.memberships.bits() & self.filter.bits()) != 0 } } From c40647efd5420e45afb52bc4b2caba7d7abe9fdc Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sun, 21 Jul 2024 10:46:52 +0200 Subject: [PATCH 2/7] add custom friction rules needed for godot symetry --- src/dynamics/coefficient_combine_rule.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dynamics/coefficient_combine_rule.rs b/src/dynamics/coefficient_combine_rule.rs index 9f99b7daf..565223d35 100644 --- a/src/dynamics/coefficient_combine_rule.rs +++ b/src/dynamics/coefficient_combine_rule.rs @@ -17,6 +17,8 @@ pub enum CoefficientCombineRule { Min, /// The two coefficients are multiplied. Multiply, + /// The sum of the two coefficients. + Sum, /// The greatest coefficient is chosen. Max, } @@ -27,8 +29,9 @@ impl CoefficientCombineRule { match effective_rule { 0 => (coeff1 + coeff2) / 2.0, - 1 => coeff1.min(coeff2), + 1 => coeff1.min(coeff2).abs(), 2 => coeff1 * coeff2, + 3 => (coeff1 + coeff2).clamp(0.0, 1.0), _ => coeff1.max(coeff2), } } From 4befe6a0aca25f991575ddb4714f2413821e5d80 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sun, 22 Sep 2024 17:44:29 +0200 Subject: [PATCH 3/7] temporary build fix --- src/pipeline/physics_pipeline.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 8505618f0..729c6f820 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -439,6 +439,14 @@ impl PhysicsPipeline { for handle in impulse_joints_iterator { islands.wake_up(bodies, handle.0, true); } + #[cfg(feature = "enhanced-determinism")] + for handle in impulse_joints + .to_wake_up + .drain(..) + .chain(multibody_joints.to_wake_up.drain(..)) + { + islands.wake_up(bodies, handle.0, true); + } // Apply modifications. let mut modified_colliders = colliders.take_modified(); From 11bf16c7ab694a8576d9895cf8a95f1d6dd6dd3b Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Fri, 11 Oct 2024 22:37:20 +0200 Subject: [PATCH 4/7] Update physics_pipeline.rs --- src/pipeline/physics_pipeline.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 729c6f820..8505618f0 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -439,14 +439,6 @@ impl PhysicsPipeline { for handle in impulse_joints_iterator { islands.wake_up(bodies, handle.0, true); } - #[cfg(feature = "enhanced-determinism")] - for handle in impulse_joints - .to_wake_up - .drain(..) - .chain(multibody_joints.to_wake_up.drain(..)) - { - islands.wake_up(bodies, handle.0, true); - } // Apply modifications. let mut modified_colliders = colliders.take_modified(); From e915ed05b37d90271fcd677f626b02a0680b62ae Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Fri, 11 Oct 2024 22:38:16 +0200 Subject: [PATCH 5/7] Update physics_pipeline.rs --- src/pipeline/physics_pipeline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 8505618f0..ebc177bd0 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -499,7 +499,7 @@ impl PhysicsPipeline { if let Some(queries) = query_pipeline.as_deref_mut() { self.counters.stages.query_pipeline_time.start(); - queries.update_incremental(colliders, &modified_colliders, &removed_colliders, false); + queries.update_incremental(colliders, &modified_colliders, &removed_colliders, true); self.counters.stages.query_pipeline_time.pause(); } From 4078769a1b36f7cdf6c3fc5eec7f4fde14aba370 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sat, 12 Oct 2024 10:45:33 +0200 Subject: [PATCH 6/7] Update collider.rs --- src/geometry/collider.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index 1ceab439e..10d19a6a2 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -686,7 +686,7 @@ impl ColliderBuilder { /// Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers. pub fn trimesh(vertices: Vec>, indices: Vec<[u32; 3]>) -> Self { - Self::new(SharedShape::trimesh(vertices, indices)) + Self::new(SharedShape::trimesh(vertices, indices).unwrap()) } /// Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers and @@ -696,7 +696,7 @@ impl ColliderBuilder { indices: Vec<[u32; 3]>, flags: TriMeshFlags, ) -> Self { - Self::new(SharedShape::trimesh_with_flags(vertices, indices, flags)) + Self::new(SharedShape::trimesh_with_flags(vertices, indices, flags).unwrap()) } /// Initializes a collider builder with a shape converted from the given triangle mesh index From d0ffd2a8a17901bd836b8aa98a107d7cb12b9249 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sat, 12 Oct 2024 21:25:22 +0200 Subject: [PATCH 7/7] Update mesh_converter.rs --- src/geometry/mesh_converter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geometry/mesh_converter.rs b/src/geometry/mesh_converter.rs index a4c886149..e5d5b833a 100644 --- a/src/geometry/mesh_converter.rs +++ b/src/geometry/mesh_converter.rs @@ -60,9 +60,9 @@ impl MeshConverter { ) -> Result<(SharedShape, Isometry), MeshConverterError> { let mut transform = Isometry::identity(); let shape = match self { - MeshConverter::TriMesh => SharedShape::trimesh(vertices, indices), + MeshConverter::TriMesh => SharedShape::trimesh(vertices, indices).unwrap(), MeshConverter::TriMeshWithFlags(flags) => { - SharedShape::trimesh_with_flags(vertices, indices, *flags) + SharedShape::trimesh_with_flags(vertices, indices, *flags).unwrap() } MeshConverter::Obb => { let (pose, cuboid) = parry::utils::obb(&vertices);