From 25b7ce3f40d2f40e3ef4a66085498f9d40073cc7 Mon Sep 17 00:00:00 2001 From: Irlan Date: Tue, 23 Apr 2019 05:45:47 -0300 Subject: [PATCH] Output iterations on initial overlap and decrease tolerance --- src/bounce/collision/gjk/gjk.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bounce/collision/gjk/gjk.cpp b/src/bounce/collision/gjk/gjk.cpp index 4a397cc..ed3a024 100644 --- a/src/bounce/collision/gjk/gjk.cpp +++ b/src/bounce/collision/gjk/gjk.cpp @@ -866,21 +866,20 @@ bool b3GJKShapeCast(b3GJKShapeCastOutput* output, B3_ASSERT(bound > 0.0f); float32 t = 0.0f; - - const float32 tolerance = 0.5f * B3_LINEAR_SLOP; - b3SimplexCache cache; cache.count = 0; - b3GJKOutput gjkOut = b3GJK(xf1, proxy1, xf2, proxy2, false, &cache); float32 d = gjkOut.distance; if (d == 0.0f) { // Overlap + output->iterations = 0; return false; } + const float32 tolerance = 0.25f * B3_LINEAR_SLOP; + b3Vec3 n = gjkOut.point2 - gjkOut.point1; n /= d; @@ -900,7 +899,6 @@ bool b3GJKShapeCast(b3GJKShapeCastOutput* output, ++iter; B3_ASSERT(d >= radius); - float32 dt = (d - radius) / bound; t += dt;