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