Add params.velocity_based_erp_inv_dt() helper

This commit is contained in:
Emil Ernerfeldt
2021-02-17 19:08:43 +01:00
parent 21247a1236
commit 4162aed2a0
5 changed files with 29 additions and 35 deletions

View File

@@ -64,6 +64,8 @@ impl VelocityGroundConstraint {
push: bool,
) {
let inv_dt = params.inv_dt();
let velocity_based_erp_inv_dt = params.velocity_based_erp_inv_dt();
let mut rb1 = &bodies[manifold.data.body_pair.body1];
let mut rb2 = &bodies[manifold.data.body_pair.body2];
let flipped = manifold.data.relative_dominance < 0;
@@ -162,10 +164,7 @@ impl VelocityGroundConstraint {
* (vel1 - vel2).dot(&force_dir1);
rhs += manifold_point.dist.max(0.0) * inv_dt;
rhs *= params.velocity_solve_fraction;
rhs += is_resting
* params.velocity_based_erp
* inv_dt
* manifold_point.dist.min(0.0);
rhs += is_resting * velocity_based_erp_inv_dt * manifold_point.dist.min(0.0);
constraint.elements[k].normal_part = VelocityGroundConstraintElementPart {
gcross2,