The
Ray data type represents a
half-line, which starts at a point and goes in a direction infinitely. Rays are most used with the
FindPartOnRay method of the

Workspace.
| Ray Lua Object
|
| Constructors
|
| Vector3
|
direction)
|
Creates a new Ray at origin with a direction of direction
|
|
| Fields
|
| Vector3
|
Origin
|
The start position of the Ray
|
| Vector3
|
Direction
|
The direction that the Ray is pointing
|
|
| Methods
|
| Number
|
Distance(point)
|
Returns the shortest distance from the ray to a point
|
| Vector3
|
ClosestPoint(point)
|
Returns the closest point on the Ray to the given point
|
|
Referenced by
|
|---|
|
| Basic Lua types | |
|---|
|
| Roblox types | | Colors | |
|---|
| | Sequences | |
|---|
| | Events | |
|---|
| | Vectors | |
|---|
| | Instances | |
|---|
| | Internal types | |
|---|
| | Other types | |
|---|
|
|---|
|
| API reference only | |
|---|