Small improvements in sphere and cylinder raycasting
This commit is contained in:
parent
188251afd4
commit
78193d9b03
|
@ -175,10 +175,8 @@ bool CylinderShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
|
||||||
(mDotN - nDotD) + t) <= decimal(0.0));
|
(mDotN - nDotD) + t) <= decimal(0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
t = t0;
|
|
||||||
|
|
||||||
// If the intersection is behind the origin of the ray, we return no hit
|
// 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
|
// Raycast method with feedback information
|
||||||
|
|
|
@ -69,10 +69,7 @@ bool SphereShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
|
||||||
decimal discriminant = b*b - c;
|
decimal discriminant = b*b - c;
|
||||||
|
|
||||||
// If the discriminant is negative, there is no intersection
|
// If the discriminant is negative, there is no intersection
|
||||||
if (discriminant < decimal(0.0)) return false;
|
return (discriminant >= decimal(0.0));
|
||||||
|
|
||||||
// There is an intersection
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Raycast method with feedback information
|
// Raycast method with feedback information
|
||||||
|
|
Loading…
Reference in New Issue
Block a user