Add restitution.

This commit is contained in:
Crozet Sébastien
2020-11-03 11:21:06 +01:00
parent a38fdc101d
commit 502be0245c
10 changed files with 152 additions and 12 deletions

View File

@@ -238,8 +238,13 @@ impl VelocityConstraint {
+ gcross1.gdot(gcross1)
+ gcross2.gdot(gcross2));
let rhs = (vel1 - vel2).dot(&force_dir1)
+ manifold_point.dist.max(0.0) * params.inv_dt();
let mut rhs = (vel1 - vel2).dot(&force_dir1);
if rhs <= -params.restitution_velocity_threshold {
rhs += manifold.restitution * rhs
}
rhs += manifold_point.dist.max(0.0) * params.inv_dt();
let impulse = manifold_points[k].impulse * warmstart_coeff;