Ray
Ray
Overview
Description
A Ray
represents a ray in 3D space. It is defined by two properties: the origin and the direction. It is commonly used in calculations such as collision detection, raycasting, and geometry operations.
Properties
Origin
Vector3
The starting point of the ray in 3D space.
Code Samples
Direction
Vector3
The normalized vector indicating the direction of the ray.
Code Samples
Constructors
new
Creates a new Ray
instance with the given Origin
and Direction
.
Parameters
Vector3
InOrigin
The origin point of the ray in 3D space.
Vector3
InDirection
The direction vector of the ray. It is usually normalized.
Return
Ray
A new `Ray` instance.
Code Samples
Methods
Unit
Returns a Ray
where the direction vector is normalized.
Parameters
None
Return
Ray
A copy of the ray, but with a normalized direction vector.
Code Samples
ClosestPoint
Finds the closest point on the ray to a given point in 3D space.
Parameters
Vector3
InPoint
The point in 3D space to find the closest point to.
Return
Vector3
The closest point on the ray to the provided point.
Code Samples
Distance
Calculates the perpendicular distance between the ray and a given point.
Parameters
Vector3
InPoint
The point in 3D space to calculate the perpendicular distance to.
Return
number
The distance between the ray and the point.
Code Samples
Last updated