diff options
| author | Sébastien Crozet <developer@crozet.re> | 2021-02-18 18:39:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-18 18:39:52 +0100 |
| commit | c650bb1feff8763b309e0705fe6427ce94ed2b2e (patch) | |
| tree | 7dd9e71cc6b4e44028989779e07c108facb20461 /src/dynamics/solver/velocity_constraint.rs | |
| parent | 9a15838ad568958273218b678ac22e53bb0a0842 (diff) | |
| parent | 5e7eedc3fdf74b49ecd999b003570bf352ee3f11 (diff) | |
| download | rapier-c650bb1feff8763b309e0705fe6427ce94ed2b2e.tar.gz rapier-c650bb1feff8763b309e0705fe6427ce94ed2b2e.tar.bz2 rapier-c650bb1feff8763b309e0705fe6427ce94ed2b2e.zip | |
Merge pull request #114 from EmbarkStudios/split-contacts-2
Split bouncy and resting contacts (take 2)
Diffstat (limited to 'src/dynamics/solver/velocity_constraint.rs')
| -rw-r--r-- | src/dynamics/solver/velocity_constraint.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dynamics/solver/velocity_constraint.rs b/src/dynamics/solver/velocity_constraint.rs index 514434b..2cac93d 100644 --- a/src/dynamics/solver/velocity_constraint.rs +++ b/src/dynamics/solver/velocity_constraint.rs @@ -239,13 +239,10 @@ impl VelocityConstraint { + gcross1.gdot(gcross1) + gcross2.gdot(gcross2)); - let mut rhs = (vel1 - vel2).dot(&force_dir1); - - if rhs <= -params.restitution_velocity_threshold { - rhs += manifold_point.restitution * rhs - } - - rhs += 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; |
