Constructor
new Ray(optionsopt)
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Options: Properties
|
- Source
Members
(static, constant) AWAY
- Source
(static, constant) INPLANE
- Source
(static, constant) INSIDE
- Source
(static, constant) OUTSIDE
- Source
Methods
getEndPosition() → {Vec3}
Returns ray end position.
- Source
- Type:
- Vec3
getPoint(distance) → {Vec3}
Get a point on the ray at a given distance t
.
Name | Type | Description |
---|---|---|
distance | number | Distance from the origin along the ray. |
- Source
The point at distance t
.
- Type:
- Vec3
getStartPosition() → {Vec3}
Returns ray start position.
- Source
- Type:
- Vec3
getVisibility() → {boolean}
Returns visibility.
- Source
- Type:
- boolean
hitPlaneRes(plane) → {Vec3|null}
Finds the intersection of the ray with a plane.
Name | Type | Description |
---|---|---|
plane | Plane | The plane to intersect with. |
- Source
The intersection point or null if no intersection.
- Type:
- Vec3 |
null
hitSphere(sphere) → {Vec3}
Returns a ray hit sphere coordinates. If there isn't hit returns null.
Name | Type | Description |
---|---|---|
sphere | Sphere | Sphere object. |
- Source
- Type:
- Vec3
hitTriangleRes(v0, v1, v2, res) → {number}
Returns ray hit a triangle result.
Name | Type | Description |
---|---|---|
v0 | Vec3 | First triangle corner coordinate. |
v1 | Vec3 | Second triangle corner coordinate. |
v2 | Vec3 | Third triangle corner coordinate. |
res | Vec3 | Hit point object pointer that stores hit result. |
- Source
- Hit code, could 0 - og.Ray.OUTSIDE, 1 - og.Ray.INSIDE, 2 - og.Ray.INPLANE and 3 - og.Ray.AWAY(ray goes away from triangle).
- Type:
- number
remove()
Remove from handler.
- Source
set(origin, direction) → {Ray}
Sets a ray parameters.
Name | Type | Description |
---|---|---|
origin | Vec3 | The origin of the ray. |
direction | Vec3 | The direction of the ray. |
- Source
- Type:
- Ray
setEndPosition(x, y, z)
Sets ray end position.
Name | Type | Description |
---|---|---|
x | number | X coordinate. |
y | number | Y coordinate. |
z | number | Z coordinate. |
- Source
setEndPosition3v(position)
Sets ray end position.
Name | Type | Description |
---|---|---|
position | Vec3 | Cartesian coordinates. |
- Source
setPickingColor3v(color)
Set picking color.
Name | Type | Description |
---|---|---|
color | Vec3 | Picking color. |
- Source
setStartPosition(x, y, z)
Sets ray start position.
Name | Type | Description |
---|---|---|
x | number | X coordinate. |
y | number | Y coordinate. |
z | number | Z coordinate. |
- Source
setStartPosition3v(position)
Sets ray start position.
Name | Type | Description |
---|---|---|
position | Vec3 | Cartesian coordinates. |
- Source
setVisibility(visibility)
Sets visibility.
Name | Type | Description |
---|---|---|
visibility | boolean | Visibility flag. |
- Source