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_ground_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_ground_constraint.rs')
| -rw-r--r-- | src/dynamics/solver/velocity_ground_constraint.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dynamics/solver/velocity_ground_constraint.rs b/src/dynamics/solver/velocity_ground_constraint.rs index 20642ec..88f864a 100644 --- a/src/dynamics/solver/velocity_ground_constraint.rs +++ b/src/dynamics/solver/velocity_ground_constraint.rs @@ -154,15 +154,12 @@ impl VelocityGroundConstraint { let r = 1.0 / (rb2.effective_inv_mass + gcross2.gdot(gcross2)); - let mut rhs = (vel1 - vel2).dot(&force_dir1); + 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; - if rhs <= -params.restitution_velocity_threshold { - rhs += manifold_point.restitution * rhs - } - - rhs += manifold_point.dist.max(0.0) * inv_dt; - - let impulse = manifold_points[k].data.impulse * warmstart_coeff; + let impulse = manifold_point.data.impulse * warmstart_coeff; constraint.elements[k].normal_part = VelocityGroundConstraintElementPart { gcross2, |
