diff options
| -rw-r--r-- | examples2d/trimesh2.rs | 2 | ||||
| -rw-r--r-- | examples3d/dynamic_trimesh3.rs | 8 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs | 2 | ||||
| -rw-r--r-- | src/geometry/collider.rs | 30 | ||||
| -rw-r--r-- | src/geometry/contact_pair.rs | 2 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 8 |
6 files changed, 26 insertions, 26 deletions
diff --git a/examples2d/trimesh2.rs b/examples2d/trimesh2.rs index 1bbe521..6a51d18 100644 --- a/examples2d/trimesh2.rs +++ b/examples2d/trimesh2.rs @@ -85,7 +85,7 @@ pub fn init_world(testbed: &mut Testbed) { for k in 0..5 { let collider = ColliderBuilder::trimesh(vertices.clone(), indices.clone()) - .collision_skin(0.2); + .contact_skin(0.2); let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![ith as f32 * 8.0 - 20.0, 20.0 + k as f32 * 11.0]) .rotation(angle); diff --git a/examples3d/dynamic_trimesh3.rs b/examples3d/dynamic_trimesh3.rs index 0e24698..8d71899 100644 --- a/examples3d/dynamic_trimesh3.rs +++ b/examples3d/dynamic_trimesh3.rs @@ -36,8 +36,7 @@ pub fn do_init_world(testbed: &mut Testbed, use_convex_decomposition: bool) { -(i as f32 * 40.0 / (nsubdivs as f32) / 2.0).cos() - (j as f32 * 40.0 / (nsubdivs as f32) / 2.0).cos() }); - let heightfield = - HeightField::new(heights, vector![100.0, 2.0, 100.0]); + let heightfield = HeightField::new(heights, vector![100.0, 2.0, 100.0]); let mut trimesh = TriMesh::from(heightfield); trimesh.set_flags(TriMeshFlags::FIX_INTERNAL_EDGES); colliders.insert(ColliderBuilder::new(SharedShape::new(trimesh.clone()))); @@ -101,7 +100,8 @@ pub fn do_init_world(testbed: &mut Testbed, use_convex_decomposition: bool) { // let compound = SharedShape::compound(compound_parts); for k in 1..num_duplications + 1 { - let x = (igeom % width) as f32 * shift_xz - num_duplications as f32 * shift_xz / 2.0; + let x = + (igeom % width) as f32 * shift_xz - num_duplications as f32 * shift_xz / 2.0; let y = (igeom / width) as f32 * shift_y + 7.0; let z = k as f32 * shift_xz - num_duplications as f32 * shift_xz / 2.0; @@ -109,7 +109,7 @@ pub fn do_init_world(testbed: &mut Testbed, use_convex_decomposition: bool) { let handle = bodies.insert(body); for shape in &shapes { - let collider = ColliderBuilder::new(shape.clone()).collision_skin(0.1); + let collider = ColliderBuilder::new(shape.clone()).contact_skin(0.1); colliders.insert_with_parent(collider, handle, &mut bodies); } } 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 d20ed31..0fa499f 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 @@ -362,7 +362,7 @@ impl BroadPhaseMultiSap { let next_aabb = collider .shape .compute_aabb(next_position) - .loosened(collider.collision_skin() + prediction_distance / 2.0); + .loosened(collider.contact_skin() + prediction_distance / 2.0); aabb.merge(&next_aabb); } diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index 617881a..e02b0f2 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -30,7 +30,7 @@ pub struct Collider { pub(crate) material: ColliderMaterial, pub(crate) flags: ColliderFlags, pub(crate) bf_data: ColliderBroadPhaseData, - collision_skin: Real, + contact_skin: Real, contact_force_event_threshold: Real, /// User-defined data associated to this collider. pub user_data: u128, @@ -110,7 +110,7 @@ impl Collider { bf_data: _bf_data, // Internal ids must not be overwritten. contact_force_event_threshold, user_data, - collision_skin, + contact_skin, } = other; if self.parent.is_none() { @@ -125,7 +125,7 @@ impl Collider { self.user_data = *user_data; self.flags = *flags; self.changes = ColliderChanges::all(); - self.collision_skin = *collision_skin; + self.contact_skin = *contact_skin; } /// The physics hooks enabled for this collider. @@ -159,13 +159,13 @@ impl Collider { } /// The collision skin of this collider. - pub fn collision_skin(&self) -> Real { - self.collision_skin + pub fn contact_skin(&self) -> Real { + self.contact_skin } /// Sets the collision skin of this collider. - pub fn set_collision_skin(&mut self, skin_thickness: Real) { - self.collision_skin = skin_thickness; + pub fn set_contact_skin(&mut self, skin_thickness: Real) { + self.contact_skin = skin_thickness; } /// The friction coefficient of this collider. @@ -452,17 +452,17 @@ impl Collider { /// Compute the axis-aligned bounding box of this collider. /// /// This AABB doesn’t take into account the collider’s collision skin. - /// [`Collider::collision_skin`]. + /// [`Collider::contact_skin`]. pub fn compute_aabb(&self) -> Aabb { self.shape.compute_aabb(&self.pos) } /// Compute the axis-aligned bounding box of this collider, taking into account the - /// [`Collider::collision_skin`] and prediction distance. + /// [`Collider::contact_skin`] and prediction distance. pub fn compute_collision_aabb(&self, prediction: Real) -> Aabb { self.shape .compute_aabb(&self.pos) - .loosened(self.collision_skin + prediction) + .loosened(self.contact_skin + prediction) } /// Compute the axis-aligned bounding box of this collider moving from its current position @@ -520,7 +520,7 @@ pub struct ColliderBuilder { /// The total force magnitude beyond which a contact force event can be emitted. pub contact_force_event_threshold: Real, /// An extract thickness around the collider shape to keep them further apart when in collision. - pub collision_skin: Real, + pub contact_skin: Real, } impl ColliderBuilder { @@ -543,7 +543,7 @@ impl ColliderBuilder { active_events: ActiveEvents::empty(), enabled: true, contact_force_event_threshold: 0.0, - collision_skin: 0.0, + contact_skin: 0.0, } } @@ -982,8 +982,8 @@ impl ColliderBuilder { /// it creates a small gap between colliding object (equal to the sum of their skin). If the /// skin is sufficiently small, this might not be visually significant or can be hidden by the /// rendering assets. - pub fn collision_skin(mut self, skin_thickness: Real) -> Self { - self.collision_skin = skin_thickness; + pub fn contact_skin(mut self, skin_thickness: Real) -> Self { + self.contact_skin = skin_thickness; self } @@ -1034,7 +1034,7 @@ impl ColliderBuilder { flags, coll_type, contact_force_event_threshold: self.contact_force_event_threshold, - collision_skin: self.collision_skin, + contact_skin: self.contact_skin, user_data: self.user_data, } } diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs index 55fec2b..ee3a6ac 100644 --- a/src/geometry/contact_pair.rs +++ b/src/geometry/contact_pair.rs @@ -117,7 +117,7 @@ pub struct ContactPair { /// /// All contact manifold contain themselves contact points between the colliders. /// Note that contact points in the contact manifold do not take into account the - /// [`Collider::collision_skin`] which only affects the constraint solver and the + /// [`Collider::contact_skin`] which only affects the constraint solver and the /// [`SolverContact`]. pub manifolds: Vec<ContactManifold>, /// Is there any active contact in this contact pair? diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index bd2256b..9b0e1d3 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -898,7 +898,7 @@ impl NarrowPhase { let pos12 = co1.pos.inv_mul(&co2.pos); - let collision_skin_sum = co1.collision_skin() + co2.collision_skin(); + let contact_skin_sum = co1.contact_skin() + co2.contact_skin(); let soft_ccd_prediction1 = rb1.map(|rb| rb.soft_ccd_prediction()).unwrap_or(0.0); let soft_ccd_prediction2 = rb2.map(|rb| rb.soft_ccd_prediction()).unwrap_or(0.0); let effective_prediction_distance = if soft_ccd_prediction1 > 0.0 || soft_ccd_prediction2 > 0.0 { @@ -918,9 +918,9 @@ impl NarrowPhase { prediction_distance.max( - dt * (linvel1 - linvel2).norm()) + collision_skin_sum + dt * (linvel1 - linvel2).norm()) + contact_skin_sum } else { - prediction_distance + collision_skin_sum + prediction_distance + contact_skin_sum }; let _ = query_dispatcher.contact_manifolds( @@ -969,7 +969,7 @@ impl NarrowPhase { break; } - let effective_contact_dist = contact.dist - co1.collision_skin() - co2.collision_skin(); + let effective_contact_dist = contact.dist - co1.contact_skin() - co2.contact_skin(); let keep_solver_contact = effective_contact_dist < prediction_distance || { let world_pt1 = world_pos1 * contact.local_p1; |
