Nice little piece of code found here

public static float DistanceToLine(Ray ray, Vector3 point)
{
    return Vector3.Cross(ray.direction, point - ray.origin).magnitude;
}

 


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending