Constructor
new Ray3D(originopt, directionopt)
Create a ray
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
origin | Vector3 | <optional> | |
direction | Vector3 | <optional> | Defaults to -Z, forward |
- Source
Example
const ray = render3D.screenToRay(mousePosScreen);
const distance = raycastPlane(ray, vec3(), vec3(0, 1, 0));
if (distance !== undefined)
ball.pos3D = ray.getPosition(distance);Members
direction
Properties| Type | Description |
|---|---|
| Vector3 | Which way it goes |
- Source
origin
Properties| Type | Description |
|---|---|
| Vector3 | Where the ray starts |
- Source
Methods
copy() → {Ray3D}
Returns a new ray that is a copy of this
- Source
Returns:
- Type:
- Ray3D
getPosition(distance) → {Vector3}
Returns the point a distance along the ray
Parameters:
| Name | Type | Description |
|---|---|---|
distance | number | What the raycast helpers return |
- Source
Returns:
- Type:
- Vector3