Attenuate the warmstart impulse for CCD contacts.
CCD contacts result in very strong, instantaneous, impulses. So it is preferable to attenuate their contribution to subsequent timesteps to avoid overshooting.
This commit is contained in:
@@ -204,8 +204,12 @@ impl RigidBody {
|
||||
self.flags.contains(RigidBodyFlags::CCD_ENABLED)
|
||||
}
|
||||
|
||||
pub fn is_moving_fast(&self, dt: Real) -> bool {
|
||||
self.is_dynamic() && self.linvel.norm() * dt > self.ccd_thickness
|
||||
}
|
||||
|
||||
pub(crate) fn should_resolve_ccd(&self, dt: Real) -> bool {
|
||||
self.is_ccd_enabled() && self.is_dynamic() && self.linvel.norm() * dt > self.ccd_thickness
|
||||
self.is_ccd_enabled() && self.is_moving_fast(dt)
|
||||
}
|
||||
|
||||
/// Sets the rigid-body's mass properties.
|
||||
@@ -371,10 +375,6 @@ impl RigidBody {
|
||||
shift * Isometry::new(self.linvel * dt, self.angvel * dt) * shift.inverse()
|
||||
}
|
||||
|
||||
pub(crate) fn position_at_time(&self, dt: Real) -> Isometry<Real> {
|
||||
self.integrate_velocity(dt) * self.position
|
||||
}
|
||||
|
||||
pub(crate) fn integrate_next_position(&mut self, dt: Real, apply_damping: bool) {
|
||||
// TODO: do we want to apply damping before or after the velocity integration?
|
||||
if apply_damping {
|
||||
@@ -504,10 +504,6 @@ impl RigidBody {
|
||||
self.linvel = dpos.translation.vector * inv_dt;
|
||||
}
|
||||
|
||||
pub(crate) fn update_next_position(&mut self, dt: Real) {
|
||||
self.next_position = self.integrate_velocity(dt) * self.position;
|
||||
}
|
||||
|
||||
pub(crate) fn update_world_mass_properties(&mut self) {
|
||||
self.world_com = self.mass_properties.world_com(&self.position);
|
||||
self.effective_inv_mass = self.mass_properties.inv_mass;
|
||||
|
||||
Reference in New Issue
Block a user