@immugio/three-math-extensions / Exports / Vec3
Vec3 represents a 3D vector. It extends Vector3
from the threejs
library.
-
Vector3
↳
Vec3
- addX
- addY
- addZ
- clone
- closest
- horizontalDistanceTo
- isNear
- moveHalfWayTowards
- moveTowards
- onPlan
- toPointWithFlippedYZ
- fromPoint
- fromPoints
• new Vec3(x?
, y?
, z?
): Vec3
Name | Type |
---|---|
x? |
number |
y? |
number |
z? |
number |
Vector3.constructor
node_modules/@types/three/src/math/Vector3.d.ts:27
▸ addX(x
): Vec3
Adds x amount to this Vec3 instance and return this
Name | Type |
---|---|
x |
number |
▸ addY(y
): Vec3
Adds y amount to this Vec3 instance and return this
Name | Type |
---|---|
y |
number |
▸ addZ(z
): Vec3
Adds z amount to this Vec3 instance and return this
Name | Type |
---|---|
z |
number |
▸ clone(): Vec3
Vector3.clone
▸ closest(...points
): Vec3
Returns a clone of the point closest to this from the given points.
Name | Type |
---|---|
...points |
Vector3 [] |
▸ horizontalDistanceTo(point
): number
Get distance to another vector while ignoring the y-axis.
Name | Type |
---|---|
point |
Vector3 |
number
▸ isNear(v
, maxDistance?
): boolean
Determines if this Vec2 instance is near the target Vec2.
maxDistance is the maximum distance between the two vectors within which they are considered near
.
Name | Type | Default value |
---|---|---|
v |
Vector3 |
undefined |
maxDistance |
number |
undefined |
boolean
▸ moveHalfWayTowards(target
): Vec3
Moves this Vec3 instance halfway towards the target Vec3 by the given amount.
Name | Type | Description |
---|---|---|
target |
Vector3 |
The target Vec3. |
This Vec3 instance.
▸ moveTowards(target
, amount
): Vec3
Moves this Vec3 instance towards the target Vec3 by the given amount.
Name | Type | Description |
---|---|---|
target |
Vector3 |
The target Vec3. |
amount |
number |
The distance to move. |
This Vec3 instance.
▸ onPlan(): Vec2
Projects this Vec3 instance onto 2d plan. Vec3.z becomes Vec2.y and Vec3.y is ignored.
▸ toPointWithFlippedYZ(): Vec3
Returns a clone of this Vec3 instance with y and z swapped.
▸ fromPoint(point
): Vec3
Creates a new Vec3 instance from an {x, y, z} object.
Name | Type | Description |
---|---|---|
point |
Point3 |
The {x, y, z} instance. |
A new Vec3 instance.
▸ fromPoints(...points
): Vec3
[]
Creates a new Vec3[] array from arguments of {x, y, z} objects.
Name | Type | Description |
---|---|---|
...points |
Point3 [] |
The ...{x, y, z} instances. |
Vec3
[]