Always apply the predictive contact term, even for bouncing contacts

This commit is contained in:
Emil Ernerfeldt
2021-02-18 17:58:17 +01:00
parent 287cd46295
commit 5e7eedc3fd
4 changed files with 22 additions and 28 deletions

View File

@@ -239,11 +239,10 @@ impl VelocityConstraint {
+ gcross1.gdot(gcross1)
+ gcross2.gdot(gcross2));
let rhs = if manifold_point.is_bouncy() {
(1.0 + manifold_point.restitution) * (vel1 - vel2).dot(&force_dir1)
} else {
(vel1 - vel2).dot(&force_dir1) + manifold_point.dist.max(0.0) * inv_dt
};
let is_bouncy = manifold_point.is_bouncy() as u32 as Real;
let rhs = (1.0 + is_bouncy * manifold_point.restitution)
* (vel1 - vel2).dot(&force_dir1)
+ manifold_point.dist.max(0.0) * inv_dt;
let impulse = manifold_point.data.impulse * warmstart_coeff;