[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
[property:Vector3 origin]
The origin of the [page:Ray].
[property:Vector3 direction]
The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
Methods
[method:Ray applyMatrix4]( [page:Matrix4 matrix4] )
matrix4 -- [page:Matrix4] The [page:Matrix4] to transform this [page:Ray] by.
Transform this [page:Ray] by the [page:Matrix4].
[method:Vector3 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].
[method:Ray clone]()
Create a clone of this [page:Ray].
[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )
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.
[method:Ray copy]( [page:Ray ray] )
ray -- [page:Ray] The [page:Ray] to copy values from.
Copy the properties of the provided [page:Ray], then return this [page:Ray].
[method:Float 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.
[method:Float distanceToPlane]( [page:Plane plane] )
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].
[method:Float distanceToPoint]( [page:Vector3 point] )
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].
[method:Float distanceSqToPoint]( [page:Vector3 point] )
point -- [page:Vector3] The [page:Vector3] to compute a distance to.
Get the squared distance of the closest approach between the [page:Ray] and the [page:Vector3].
[method:Boolean equals]( [page:Ray ray] )
ray -- [page:Ray] The [page:Ray] to compare to.
Return whether this and the other [page:Ray] have equal offsets and directions.
[method:Vector3 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.
[method:Vector3 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 )
[method:Vector3 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.
[method:Boolean intersectsBox]( [page:Box3 box] )
box -- [page:Box3] The [page:Box3] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Box3].
[method:Boolean intersectsPlane]( [page:Plane plane] )
plane -- [page:Plane] The [page:Plane] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Plane].
[method:Boolean intersectsSphere]( [page:Sphere sphere] )
sphere -- [page:Sphere] The [page:Sphere] to intersect with.
Return whether or not this [page:Ray] intersects with the [page:Sphere].
[method:Ray 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.
[method:Ray set]( [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.
Copy the parameters to the origin and direction properties.
[method:Ray lookAt]( [page:Vector3 v] )
v -- [page:Vector3] The vector to look at.
Adjusts the direction of the ray to point at the vector in world coordinates.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]