A ray that emits from an origin in a certain direction. This is used by the Raycaster to assist with raycasting. Raycasting is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst other things.
Creates a new Ray.
The origin of the Ray. Default is a Vector3 at (0, 0, 0).
The direction of the Ray. This must be normalized (with Vector3.normalize) for the methods to operate properly. Default is a Vector3 at (0, 0, -1).
matrix4 — the Matrix4 to apply to this Ray.
Transform this Ray by the Matrix4.
Get a Vector3 that is a given distance along this Ray.
Creates a new Ray with identical origin and direction to this one.
Get the point along this Ray that is closest to the Vector3 provided.
Copies the origin and direction properties of ray into this ray.
point — the Vector3 to compute a distance to.
Get the squared distance of the closest approach between the Ray and the Vector3.
Get the squared distance between this Ray and a line segment.
plane — the plane to get the distance to.
Get the distance from origin to the Plane, or null if the Ray doesn't intersect the Plane.
point — Vector3 The Vector3 to compute a distance to.
Get the distance of the closest approach between the Ray and the point.
Returns true if this and the other ray have equal origin and direction.
Intersect this Ray with a Box3, returning the intersection point or null if there is no intersection.
Intersect this Ray with a Plane, returning the intersection point or null if there is no intersection.
Intersect this Ray with a Sphere, returning the intersection point or null if there is no intersection.
Intersect this Ray with a triangle, returning the intersection point or null if there is no intersection.
box — the Box3 to intersect with.
Return true if this Ray intersects with the Box3.
plane — the Plane to intersect with.
Return true if this Ray intersects with the Plane.
sphere — the Sphere to intersect with.
Return true if this Ray intersects with the Sphere.
Adjusts the direction of the ray to point at the vector in world coordinates.
t — The distance along the Ray to interpolate.
Shift the origin of this Ray along its direction by the distance given.
Sets this ray's origin and direction properties by copying the values from the given objects.
For more info on how to obtain the source code of this module see this page.