[name]

A ray that emits from an origin in a certain direction.

Constructor

[name]([page:Vector3 origin], [page:Vector3 direction])

origin -- [page:Vector3] The origin of the [page:Ray].
direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
Initialises the origin and direction properties to the provided values.

Properties

.[page:Vector3 origin]

The origin of the [page:Ray].

.[page:Vector3 direction]

The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.

Methods

.applyMatrix4([page:Matrix4 matrix4]) [page:Ray]

matrix4 -- [page:Matrix4] The [page:Matrix4] to transform this [page:Ray] by.
Transform this [page:Ray] by the [page:Matrix4].

.at([page:Float t], [page:Vector3 optionalTarget] = null) [page:Vector3]

t -- [page:Float] The distance along the [page:Ray] to retrieve a position for.
optionalTarget -- [page:Vector3] Receives the position along the [page:Ray] if passed; otherwise a new [page:Vector3] is created.
Get a [page:Vector3] that is a given distance along this [page:Ray].

.clone() [page:Ray]

Create a clone of this [page:Ray].

.closestPointToPoint([page:Vector3 point], [page:Vector3 optionalTarget]) [page:Vector3]

point -- [page:Vector3] The point to get the closest approach to.
optionalTarget -- [page:Vector3] Receives the return value if passed; otherwise a new [page:Vector3] is created.
Get the point along this [page:Ray] that is closest to the [page:Vector3] provided.

.copy([page:Ray ray]) [page:Ray]

ray -- [page:Ray] The [page:Ray] to copy values from.
Copy the properties of the provided [page:Ray], then return this [page:Ray].

.distanceSqToSegment([page:Vector3 v0], [page:Vector3 v1], [page:Vector3 optionalPointOnRay] = null, [page:Vector3 optionalPointOnSegment] = null) [page:Float]

v0 -- [page:Vector3] The start of the line segment. v1 -- [page:Vector3] The end of the line segment. optionalPointOnRay -- [page:Vector3] If this is provided, it receives the point on this [page:Ray] that is closest to the segment. optionalPointOnSegment -- [page:Vector3] If this is provided, it receives the point on the line segment that is closest to this [page:Ray].
Get the squared distance between this [page:Ray] and a line segment.

.distanceToPlane([page:Plane plane]) [page:Float]

plane -- [page:Plane] The [page:Plane] to get the distance to.
Get the distance from the origin to the [page:Plane], or *null* if the [page:Ray] doesn't intersect the [page:Plane].

.distanceToPoint([page:Vector3 point]) [page:Float]

point -- [page:Vector3] The [page:Vector3] to compute a distance to.
Get the distance of the closest approach between the [page:Ray] and the [page:Vector3].

.equals([page:Ray ray]) [page:Boolean]

ray -- [page:Ray] The [page:Ray] to compare to.
Return whether this and the other [page:Ray] have equal offsets and directions.

.intersectBox([page:Box3 box], [page:Vector3 optionalTarget] = null) [page:Vector3]?

box -- [page:Box3] The [page:Box3] to intersect with.
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
Intersect this [page:Ray] with a [page:Box3], returning the intersection point or *null* if there is no intersection.

.intersectPlane([page:Plane plane], [page:Vector3 optionalTarget] = null) [page:Vector3]?

plane -- [page:Plane] The [page:Plane] to intersect with.
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
Intersect this [page:Ray] with a [page:Plane], returning the intersection point or *null* if there is no intersection.
function ( a, b, c, backfaceCulling, optionalTarget )

.intersectTriangle([page:Vector3 a], [page:Vector3 b], [page:Vector3 c], [page:Boolean backfaceCulling], [page:Vector3 optionalTarget] = null) [page:Vector3]?

a, b, c -- [page:Vector3] The [page:Vector3] points on the triangle.
backfaceCulling -- [page:Boolean] Whether to use backface culling.
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
Intersect this [page:Ray] with a triangle, returning the intersection point or *null* if there is no intersection.

.isIntersectionBox([page:Box3 box]) [page:Boolean]

box -- [page:Box3] The [page:Box3] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Box3].

.isIntersectionPlane([page:Plane plane]) [page:Boolean]

plane -- [page:Plane] The [page:Plane] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Plane].

.isIntersectionSphere([page:Sphere sphere]) [page:Boolean]

sphere -- [page:Sphere] The [page:Sphere] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Sphere].

.recast([page:Float t])

t -- The distance along the [page:Ray] to interpolate.
Shift the origin of this [page:Ray] along its direction by the distance given.

.set([page:Vector3 origin], [page:Vector3 direction]) [page:Ray]

origin -- [page:Vector3] The origin of the [page:Ray].
direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
Copy the parameters to the origin and direction properties.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]