Constructor
new Ray(originopt, directionopt)
Methods
applyMatrix4(matrix4) → {Ray}
Transform this Ray by the Matrix4.
Name | Type | Description |
---|---|---|
matrix4 | Matrix4 | the Matrix4 to apply to this Ray. |
- Type:
- Ray
at(t, optionalTargetopt) → {Vector3}
Get a Vector3 that is a given distance along this Ray.
Name | Type | Attributes | Description |
---|---|---|---|
t | number | the distance along the Ray to retrieve a position for. | |
optionalTarget | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
copy(ray) → {Ray}
Copies the origin and direction properties of ray into this ray.
Name | Type | Description |
---|---|---|
ray | Ray |
- Type:
- Ray
distanceSqToPoint(point) → {number}
Get the squared distance of the closest approach between the Ray and the Vector3.
Name | Type | Description |
---|---|---|
point | Vector3 | the Vector3 to compute a distance to. |
- Type:
- number
distanceToPlane(plane) → {number}
Get the distance of the closest approach between the Ray and the Plane.
Name | Type | Description |
---|---|---|
plane | Plane | the Plane to compute a distance to. |
- Type:
- number
intersectBox(box, optionalTargetopt) → {Vector3}
Intersect this Ray with a Box3, returning the intersection point or null if there is no intersection.
Name | Type | Attributes | Description |
---|---|---|---|
box | Box3 | the Box3 to intersect with. | |
optionalTarget | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
intersectPlane(plane, optionalTargetopt) → {Vector3}
Intersect this Ray with a Plane, returning the intersection point or null if there is no intersection.
Name | Type | Attributes | Description |
---|---|---|---|
plane | Plane | the Plane to intersect with. | |
optionalTarget | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
intersectSphere(sphere, optionalTargetopt) → {Vector3}
Intersect this Ray with a Sphere, returning the intersection point or null if there is no intersection.
Name | Type | Attributes | Description |
---|---|---|---|
sphere | Sphere | the Sphere to intersect with. | |
optionalTarget | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
intersectTriangle(a, b, c, backfaceCulling, optionalTargetopt) → {Vector3}
Intersect this Ray with a triangle, returning the intersection point or null if there is no intersection.
Name | Type | Attributes | Description |
---|---|---|---|
a | Vector3 | The Vector3 point making up the triangle. | |
b | Vector3 | The Vector3 point making up the triangle. | |
c | Vector3 | The Vector3 point making up the triangle. | |
backfaceCulling | boolean | whether to use backface culling. | |
optionalTarget | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
intersectsBox(box) → {boolean}
Return true if this Ray intersects with the Box3.
Name | Type | Description |
---|---|---|
box | Box3 | the Box3 to intersect with. |
- Type:
- boolean
intersectsPlane(plane) → {boolean}
Return true if this Ray intersects with the Plane.
Name | Type | Description |
---|---|---|
plane | Plane | the plane to intersect with. |
- Type:
- boolean
intersectsSphere(sphere) → {boolean}
Return true if this Ray intersects with the Sphere.
Name | Type | Description |
---|---|---|
sphere | Sphere | the Sphere to intersect with. |
- Type:
- boolean
set(origin, direction) → {Ray}
Sets this ray's origin and direction properties by copying the values from the given objects.
Name | Type | Description |
---|---|---|
origin | Vector3 | the origin of the Ray. |
direction | Vector3 | the direction of the Ray. This must be normalized (with Vector3.normalize) for the methods to operate properly. |
- Type:
- Ray