diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-01-23 16:50:02 +0100 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2022-01-23 16:50:26 +0100 |
| commit | 78c8bc6cdef26d14c57d0eeb23188cba592961bf (patch) | |
| tree | b26951b1b08c66171e172237dfce6024792b36e9 /src/dynamics/solver/generic_velocity_ground_constraint_element.rs | |
| parent | b7bf80550d8cc61637a251aa2ba0e6cdb8d26b74 (diff) | |
| download | rapier-78c8bc6cdef26d14c57d0eeb23188cba592961bf.tar.gz rapier-78c8bc6cdef26d14c57d0eeb23188cba592961bf.tar.bz2 rapier-78c8bc6cdef26d14c57d0eeb23188cba592961bf.zip | |
Improve cfm configuration using the critical damping factor
Diffstat (limited to 'src/dynamics/solver/generic_velocity_ground_constraint_element.rs')
| -rw-r--r-- | src/dynamics/solver/generic_velocity_ground_constraint_element.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dynamics/solver/generic_velocity_ground_constraint_element.rs b/src/dynamics/solver/generic_velocity_ground_constraint_element.rs index 80c97ab..f645f04 100644 --- a/src/dynamics/solver/generic_velocity_ground_constraint_element.rs +++ b/src/dynamics/solver/generic_velocity_ground_constraint_element.rs @@ -75,6 +75,7 @@ impl VelocityGroundConstraintNormalPart<Real> { #[inline] pub fn generic_solve( &mut self, + cfm_factor: Real, j_id2: usize, jacobians: &DVector<Real>, ndofs2: usize, @@ -86,7 +87,7 @@ impl VelocityGroundConstraintNormalPart<Real> { .dot(&mj_lambdas.rows(mj_lambda2, ndofs2)) + self.rhs; - let new_impulse = (self.impulse - self.r * dvel).max(0.0); + let new_impulse = cfm_factor * (self.impulse - self.r * dvel).max(0.0); let dlambda = new_impulse - self.impulse; self.impulse = new_impulse; @@ -101,6 +102,7 @@ impl VelocityGroundConstraintNormalPart<Real> { impl VelocityGroundConstraintElement<Real> { #[inline] pub fn generic_solve_group( + cfm_factor: Real, elements: &mut [Self], jacobians: &DVector<Real>, limit: Real, @@ -121,7 +123,7 @@ impl VelocityGroundConstraintElement<Real> { for element in elements.iter_mut() { element .normal_part - .generic_solve(nrm_j_id, jacobians, ndofs2, mj_lambda2, mj_lambdas); + .generic_solve(cfm_factor, nrm_j_id, jacobians, ndofs2, mj_lambda2, mj_lambdas); nrm_j_id += j_step; } } |
