From 63bff54a699ff3005b036e7e248b75646daacd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 24 Sep 2017 23:33:08 -0700 Subject: [PATCH] Fixed ray/cylinder intersection. --- examples/common/bounds.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/common/bounds.cpp b/examples/common/bounds.cpp index 5a00812d6..c6edfd1fb 100644 --- a/examples/common/bounds.cpp +++ b/examples/common/bounds.cpp @@ -561,6 +561,11 @@ bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, Inters const float ddoto = bx::vec3Dot(_ray.m_dir, vo); const float ss = t0 - bx::fabs(bx::fsqrt(rsq - bx::fsq(dist) ) / ddoto); + if (0.0f > ss) + { + return false; + } + float point[3]; getPointAt(point, _ray, ss);