CCD improvements
- Fix bug where the CCD thickness wasn’t initialized properly. - Fix bug where the contact compliance would result in unwanted tunelling, despite CCD being enabled.
This commit is contained in:
@@ -93,6 +93,7 @@ pub(crate) struct VelocityGroundConstraintNormalPart<N: WReal> {
|
||||
pub rhs_wo_bias: N,
|
||||
pub impulse: N,
|
||||
pub r: N,
|
||||
pub cfm: N,
|
||||
}
|
||||
|
||||
impl<N: WReal> VelocityGroundConstraintNormalPart<N> {
|
||||
@@ -103,6 +104,7 @@ impl<N: WReal> VelocityGroundConstraintNormalPart<N> {
|
||||
rhs_wo_bias: na::zero(),
|
||||
impulse: na::zero(),
|
||||
r: na::zero(),
|
||||
cfm: na::one(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +119,7 @@ impl<N: WReal> VelocityGroundConstraintNormalPart<N> {
|
||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||
{
|
||||
let dvel = -dir1.dot(&mj_lambda2.linear) + self.gcross2.gdot(mj_lambda2.angular) + self.rhs;
|
||||
let new_impulse = cfm_factor * (self.impulse - self.r * dvel).simd_max(N::zero());
|
||||
let new_impulse = self.cfm * (self.impulse - self.r * dvel).simd_max(N::zero());
|
||||
let dlambda = new_impulse - self.impulse;
|
||||
self.impulse = new_impulse;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user