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/velocity_ground_constraint.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/velocity_ground_constraint.rs')
| -rw-r--r-- | src/dynamics/solver/velocity_ground_constraint.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dynamics/solver/velocity_ground_constraint.rs b/src/dynamics/solver/velocity_ground_constraint.rs index 76de3f9..cf7d9eb 100644 --- a/src/dynamics/solver/velocity_ground_constraint.rs +++ b/src/dynamics/solver/velocity_ground_constraint.rs @@ -153,7 +153,7 @@ impl VelocityGroundConstraint { .effective_world_inv_inertia_sqrt .transform_vector(dp2.gcross(-force_dir1)); - let r = params.delassus_inv_factor + let projected_mass = 1.0 / (force_dir1.dot(&mprops2.effective_inv_mass.component_mul(&force_dir1)) + gcross2.gdot(gcross2)); @@ -172,8 +172,8 @@ impl VelocityGroundConstraint { gcross2, rhs: rhs_wo_bias + rhs_bias, rhs_wo_bias, - impulse: 0.0, - r, + impulse: na::zero(), + r: projected_mass, }; } @@ -219,6 +219,7 @@ impl VelocityGroundConstraint { pub fn solve( &mut self, + cfm_factor: Real, mj_lambdas: &mut [DeltaVel<Real>], solve_normal: bool, solve_friction: bool, @@ -226,6 +227,7 @@ impl VelocityGroundConstraint { let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize]; VelocityGroundConstraintElement::solve_group( + cfm_factor, &mut self.elements[..self.num_contacts as usize], &self.dir1, #[cfg(feature = "dim3")] |
