diff options
| author | Sébastien Crozet <developer@crozet.re> | 2021-03-08 10:09:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-08 10:09:43 +0100 |
| commit | beaddea6f2596dce936355940fd98ca90945cb65 (patch) | |
| tree | 22a8e6863cce5daab7782c5de108749e5d046fbb /src/pipeline | |
| parent | e7f805aea45612abb655b3c36a133357fecfcdc4 (diff) | |
| parent | 152ada67ecd122fe38a9cae8b262542b4abf25fc (diff) | |
| download | rapier-beaddea6f2596dce936355940fd98ca90945cb65.tar.gz rapier-beaddea6f2596dce936355940fd98ca90945cb65.tar.bz2 rapier-beaddea6f2596dce936355940fd98ca90945cb65.zip | |
Merge pull request #146 from dimforge/implicit_friction_cone
Projection friction impulses on an implicit cone instead of a pyramid approximation.
Diffstat (limited to 'src/pipeline')
| -rw-r--r-- | src/pipeline/physics_hooks.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pipeline/physics_hooks.rs b/src/pipeline/physics_hooks.rs index c3621ea..72b635f 100644 --- a/src/pipeline/physics_hooks.rs +++ b/src/pipeline/physics_hooks.rs @@ -81,7 +81,15 @@ impl<'a> ContactModificationContext<'a> { // normal, so remove all the contacts and mark further contacts // as forbidden. self.solver_contacts.clear(); - *self.user_data = CONTACT_CURRENTLY_FORBIDDEN; + + // NOTE: in some very rare cases `local_n1` will be + // zero if the objects are exactly touching at one point. + // So in this case we can't really conclude. + // If the norm is non-zero, then we can tell we need to forbid + // further contacts. Otherwise we have to wait for the next frame. + if self.manifold.local_n1.norm_squared() > 0.1 { + *self.user_data = CONTACT_CURRENTLY_FORBIDDEN; + } } } CONTACT_CURRENTLY_FORBIDDEN => { |
