diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-05-30 18:21:35 +0200 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2022-05-30 18:29:18 +0200 |
| commit | 6ce26f3818492682a8572c895264f1e63f94b9d5 (patch) | |
| tree | d8efa80fafcc94584417c7da24f2bf99f6eb31ec /src/dynamics/solver/velocity_ground_constraint_element.rs | |
| parent | c630635e57624385123b4a0fb658018bc6fdba91 (diff) | |
| download | rapier-6ce26f3818492682a8572c895264f1e63f94b9d5.tar.gz rapier-6ce26f3818492682a8572c895264f1e63f94b9d5.tar.bz2 rapier-6ce26f3818492682a8572c895264f1e63f94b9d5.zip | |
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.
Diffstat (limited to 'src/dynamics/solver/velocity_ground_constraint_element.rs')
| -rw-r--r-- | src/dynamics/solver/velocity_ground_constraint_element.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dynamics/solver/velocity_ground_constraint_element.rs b/src/dynamics/solver/velocity_ground_constraint_element.rs index 06a727a..3b2ed86 100644 --- a/src/dynamics/solver/velocity_ground_constraint_element.rs +++ b/src/dynamics/solver/velocity_ground_constraint_element.rs @@ -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; |
