Small improvements in sphere and cylinder raycasting

This commit is contained in:
Daniel Chappuis 2014-09-20 16:59:47 +02:00
parent 188251afd4
commit 78193d9b03
2 changed files with 2 additions and 7 deletions

View File

@ -175,10 +175,8 @@ bool CylinderShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
(mDotN - nDotD) + t) <= decimal(0.0));
}
t = t0;
// If the intersection is behind the origin of the ray, we return no hit
return (t >= decimal(0.0));
return (t0 >= decimal(0.0));
}
// Raycast method with feedback information

View File

@ -69,10 +69,7 @@ bool SphereShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
decimal discriminant = b*b - c;
// If the discriminant is negative, there is no intersection
if (discriminant < decimal(0.0)) return false;
// There is an intersection
return true;
return (discriminant >= decimal(0.0));
}
// Raycast method with feedback information