aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/contact_pair.rs18
-rw-r--r--src/geometry/narrow_phase.rs2
2 files changed, 13 insertions, 7 deletions
diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs
index 44730a0..5db95c0 100644
--- a/src/geometry/contact_pair.rs
+++ b/src/geometry/contact_pair.rs
@@ -1,8 +1,9 @@
use crate::dynamics::{RigidBodyHandle, RigidBodySet};
use crate::geometry::{ColliderHandle, ColliderSet, Contact, ContactManifold};
-use crate::math::{Point, Real, Vector};
+use crate::math::{Point, Real, TangentImpulse, Vector, ANG_DIM};
use crate::pipeline::EventHandler;
use crate::prelude::CollisionEventFlags;
+use parry::math::AngVector;
use parry::query::ContactManifoldsWorkspace;
use super::CollisionEvent;
@@ -33,12 +34,11 @@ pub struct ContactData {
pub impulse: Real,
/// The friction impulse along the vector orthonormal to the contact normal, applied to the first
/// collider's rigid-body.
- #[cfg(feature = "dim2")]
- pub tangent_impulse: Real,
- /// The friction impulses along the basis orthonormal to the contact normal, applied to the first
- /// collider's rigid-body.
- #[cfg(feature = "dim3")]
- pub tangent_impulse: na::Vector2<Real>,
+ pub tangent_impulse: TangentImpulse<Real>,
+ /// The impulse retained for warmstarting the next simulation step.
+ pub warmstart_impulse: Real,
+ /// The friction impulse retained for warmstarting the next simulation step.
+ pub warmstart_tangent_impulse: TangentImpulse<Real>,
}
impl Default for ContactData {
@@ -46,6 +46,8 @@ impl Default for ContactData {
Self {
impulse: 0.0,
tangent_impulse: na::zero(),
+ warmstart_impulse: 0.0,
+ warmstart_tangent_impulse: na::zero(),
}
}
}
@@ -299,6 +301,8 @@ pub struct SolverContact {
pub tangent_velocity: Vector<Real>,
/// Whether or not this contact existed during the last timestep.
pub is_new: bool,
+ pub warmstart_impulse: Real,
+ pub warmstart_tangent_impulse: TangentImpulse<Real>,
}
impl SolverContact {
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs
index f754808..a711117 100644
--- a/src/geometry/narrow_phase.rs
+++ b/src/geometry/narrow_phase.rs
@@ -987,6 +987,8 @@ impl NarrowPhase {
restitution,
tangent_velocity: Vector::zeros(),
is_new: contact.data.impulse == 0.0,
+ warmstart_impulse: contact.data.warmstart_impulse,
+ warmstart_tangent_impulse: contact.data.warmstart_tangent_impulse,
};
manifold.data.solver_contacts.push(solver_contact);