From 4c3eba7d18aa497df2f3edf2dffb02b6868bc0f8 Mon Sep 17 00:00:00 2001 From: Irlan Date: Tue, 11 Apr 2017 17:06:46 -0300 Subject: [PATCH] fix issue --- src/bounce/dynamics/shapes/mesh_shape.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bounce/dynamics/shapes/mesh_shape.cpp b/src/bounce/dynamics/shapes/mesh_shape.cpp index 6cd57a0..1848821 100644 --- a/src/bounce/dynamics/shapes/mesh_shape.cpp +++ b/src/bounce/dynamics/shapes/mesh_shape.cpp @@ -138,8 +138,12 @@ bool b3MeshShape::RayCast(b3RayCastOutput* output, const b3RayCastInput& input, float32 v = b3Dot(QC_x_QA, AB_x_AC); float32 w = b3Dot(QA_x_QB, AB_x_AC); + // This tolerance helps intersections lying on + // shared edges to not be missed. + const float32 kTol = -0.005f; + // Is the intersection on the triangle? - if (u > 0.0f && v > 0.0f && w > 0.0f) + if (u > kTol && v > kTol && w > kTol) { output->fraction = t;