diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-21 21:02:23 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-21 21:02:27 +0100 |
| commit | 9b87f06a856c4d673642e210f8b0986cfdbac3af (patch) | |
| tree | b4f4eaac0e5004f8ba3fccd42e5aea4fd565dcc6 /src/geometry | |
| parent | 9ac3503b879f95fcdf5414470ba5aedf195b9a97 (diff) | |
| download | rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.tar.gz rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.tar.bz2 rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.zip | |
feat: implement new "small-steps" solver + joint improvements
Diffstat (limited to 'src/geometry')
| -rw-r--r-- | src/geometry/contact_pair.rs | 2 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs index 3bef40d..44730a0 100644 --- a/src/geometry/contact_pair.rs +++ b/src/geometry/contact_pair.rs @@ -283,7 +283,7 @@ pub struct ContactManifoldData { pub struct SolverContact { /// The index of the manifold contact used to generate this solver contact. pub(crate) contact_id: u8, - /// The world-space contact point. + /// The contact point in world-space. pub point: Point<Real>, /// The distance between the two original contacts points along the contact normal. /// If negative, this is measures the penetration depth. diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 4500284..8b5f0c9 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -927,6 +927,7 @@ impl NarrowPhase { for manifold in &mut pair.manifolds { let world_pos1 = manifold.subshape_pos1.prepend_to(&co1.pos); + let world_pos2 = manifold.subshape_pos2.prepend_to(&co2.pos); manifold.data.solver_contacts.clear(); manifold.data.rigid_body1 = co1.parent.map(|p| p.handle); manifold.data.rigid_body2 = co2.parent.map(|p| p.handle); @@ -944,10 +945,13 @@ impl NarrowPhase { if contact.dist < prediction_distance { // Generate the solver contact. + let world_pt1 = world_pos1 * contact.local_p1; + let world_pt2 = world_pos2 * contact.local_p2; + let effective_point = na::center(&world_pt1, &world_pt2); + let solver_contact = SolverContact { contact_id: contact_id as u8, - point: world_pos1 * contact.local_p1 - + manifold.data.normal * contact.dist / 2.0, + point: effective_point, dist: contact.dist, friction, restitution, |
