Collapse Sidebar


A Ray is a half-line, finite in one direction but infinite in the other. It can be defined by a 3D point, where the line originates from, and a direction vector, which is the direction it goes in.


Ray.new ( Vector3 Origin, Vector3 Direction )

Creates a new Ray with given Origin and Direction


Ray Ray.Unit

The Ray with a normalized direction

Vector3 Ray.Origin

The position of the origin

Vector3 Ray.Direction

The direction vector of the ray


Vector3 Ray:ClosestPoint ( Vector3 point )

Returns a Vector3 projected onto the ray so that it is within the Ray’s line of sight.

Note: the Ray must be a unit ray for this method to behave as expected!

number Ray:Distance ( Vector3 point )

Returns the distance between the given point and the point on the ray nearest to the given point (Ray:ClosestPoint(point)).