Ray
A ray that emits from an origin in a certain direction. This is used by the Raycaster| Raycaster to assist with ray casting. Raycaster is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst other things.
Properties
origin(0, 0, 0)
The origin of the Ray.
direction(0, 0, -1)
The direction of the Ray. This must be normalized (with Vector3.normalize) for the methods to operate properly.
Methods
set
clone
copy
at
look At
recast
closest Point To Point
distance To Point
distance Sq To Point
distance Sq To Segment
- distanceSqToSegment(
v0: Vector3,
v1: Vector3,
optionalPointOnRay?: Vector3,
optionalPointOnSegment?: Vector3,
): numberGet the squared distance between this Ray and a line segment.
Parameters
- v0: Vector3
the start of the line segment.
- v1: Vector3
the end of the line segment.
- optionalPointOnRay: Vector3
(optional) if this is provided, it receives the point on this Ray that is closest to the segment.
- optionalPointOnSegment: Vector3
(optional) if this is provided, it receives the point on the line segment that is closest to this Ray.
Returns number
- v0: Vector3
intersect Sphere
intersect Sphere Max Distance
Calculate the maximum distance between origin and one or two intersections if this ray through the sphere.
Parameters
- sphere: Sphere
Returns number
direction Distance
Calculate the length, which is the distance projected on the ray from given point to origin.
Parameters
- point: Vector3
Returns number
A ray that emits from an origin in a certain direction. This is used by the Raycaster| Raycaster to assist with ray casting. Raycaster is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst other things.