- Home /
How to get the intersection point between ray and bounding box?
Bounds has a function called intersects, which takes in a ray and tells us whether the ray intersects with the box or not. Does anyone know how to get the intersection point between the bounding box and the ray?
Comment
Answer by FlaSh-G · Jul 06, 2017 at 10:17 PM
There's a version of IntersectRay that delivers a distance value when there is an intersection. This value can be used to calculate the intersection point.
float distance;
if(bounds.IntersectRay(ray, out distance))
{
var point = ray.origin + ray.direction * distance;
}