class Vector3
Creates a new Vector3 object from the passed x, y, z (floats) coordinates.
A Vector3 is the main object used in 3D geometry.
It can represent etiher the coordinates of a point the space, either a direction.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Return true is the vector is non uniform meaning x, y or z are not all the same.
Returns a string with the Vector3 coordinates.
Returns the string "Vector3"
Returns the Vector hash code.
Returns a new array with three elements : the coordinates the Vector3.
Populates the passed array or Float32Array from the passed index with the successive coordinates of the Vector3.
Returns the Vector3.
Name | Type | Description | |
---|---|---|---|
array | FloatArray | ||
optional | index | number |
Returns a new Quaternion object, computed from the Vector3 coordinates.
Adds the passed vector to the current Vector3.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Returns a new Vector3, result of the addition the current Vector3 and the passed vector.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Adds the current Vector3 to the passed one and stores the result in the vector "result".
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 | ||
result | Vector3 |
Subtract the passed vector from the current Vector3.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Returns a new Vector3, result of the subtraction of the passed vector from the current Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Subtracts the passed vector from the current Vector3 and stores the result in the vector "result".
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 | ||
result | Vector3 |
Returns a new Vector3 set with the subtraction of the passed floats from the current Vector3 coordinates.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Subtracts the passed floats from the current Vector3 coordinates and set the passed vector "result" with this result.
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Returns a new Vector3 set with the current Vector3 negated coordinates.
Multiplies the Vector3 coordinates by the float "scale".
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
scale | number |
Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale".
Name | Type | Description | |
---|---|---|---|
scale | number |
Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the passed vector "result" coordinates.
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
scale | number | ||
result | Vector3 |
Boolean : True if the current Vector3 and the passed vector coordinates are strictly equal.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 | ||
optional | epsilon | number |
Boolean : True if the current Vector3 coordinate equal the passed floats.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Muliplies the current Vector3 coordinates by the passed ones.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Returns a new Vector3, result of the multiplication of the current Vector3 by the passed vector.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Multiplies the current Vector3 by the passed one and stores the result in the passed vector "result".
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 | ||
result | Vector3 |
Returns a new Vector3 set witth the result of the mulliplication of the current Vector3 coordinates by the passed floats.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Returns a new Vector3 set witth the result of the division of the current Vector3 coordinates by the passed ones.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 |
Divides the current Vector3 coordinates by the passed ones and stores the result in the passed vector "result".
Returns the current Vector3.
Name | Type | Description | |
---|---|---|---|
otherVector | Vector3 | ||
result | Vector3 |
Updates the current Vector3 with the minimal coordinate values between its and the passed vector ones.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
other | Vector3 |
Updates the current Vector3 with the maximal coordinate values between its and the passed vector ones.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
other | Vector3 |
Returns the length of the Vector3 (float).
Returns the squared length of the Vector3 (float).
Normalize the current Vector3.
Returns the updated Vector3.
/!\ In place operation.
Normalize the current Vector3 to a new vector.
@returns the new Vector3.
Normalize the current Vector3 to the reference.
@returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
reference | Vector3 |
Returns a new Vector3 copied from the current Vector3.
Copies the passed vector coordinates to the current Vector3 ones.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
source | Vector3 |
Copies the passed floats to the current Vector3 coordinates.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Copies the passed floats to the current Vector3 coordinates.
Returns the updated Vector3.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
*/
Name | Type | Description | |
---|---|---|---|
vector0 | Vector3 | ||
vector1 | Vector3 | ||
axis | Vector3 |
Returns a new Vector3 set from the index "offset" of the passed array.
Name | Type | Description | |
---|---|---|---|
array | ArrayLike<number> | ||
optional | offset | number |
Returns a new Vector3 set from the index "offset" of the passed Float32Array.
This function is deprecated. Use FromArray instead.
Name | Type | Description | |
---|---|---|---|
array | Float32Array | ||
optional | offset | number |
Sets the passed vector "result" with the element values from the index "offset" of the passed array.
Name | Type | Description | |
---|---|---|---|
array | ArrayLike<number> | ||
offset | number | ||
result | Vector3 |
Sets the passed vector "result" with the element values from the index "offset" of the passed Float32Array.
This function is deprecated. Use FromArrayToRef instead.
Name | Type | Description | |
---|---|---|---|
array | Float32Array | ||
offset | number | ||
result | Vector3 |
Sets the passed vector "result" with the passed floats.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Returns a new Vector3 set to (0.0, 0.0, 0.0).
Returns a new Vector3 set to (1.0, 1.0, 1.0).
Returns a new Vector3 set to (0.0, 1.0, 0.0)
Returns a new Vector3 set to (0.0, 0.0, 1.0)
Returns a new Vector3 set to (1.0, 0.0, 0.0)
Returns a new Vector3 set to (-1.0, 0.0, 0.0)
Returns a new Vector3 set with the result of the transformation by the passed matrix of the passed vector.
This method computes tranformed coordinates only, not transformed direction vectors.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
transformation | Matrix |
Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed vector.
This method computes tranformed coordinates only, not transformed direction vectors.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
transformation | Matrix | ||
result | Vector3 |
Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed floats (x, y, z).
This method computes tranformed coordinates only, not transformed direction vectors.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number | ||
transformation | Matrix |
Returns a new Vector3 set with the result of the normal transformation by the passed matrix of the passed vector.
This methods computes transformed normalized direction vectors only.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
transformation | Matrix |
Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
This methods computes transformed normalized direction vectors only.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
transformation | Matrix | ||
result | Vector3 |
Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z).
This methods computes transformed normalized direction vectors only.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number | ||
transformation | Matrix |
Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4".
Name | Type | Description | |
---|---|---|---|
value1 | Vector3 | ||
value2 | Vector3 | ||
value3 | Vector3 | ||
value4 | Vector3 |
Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max".
If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one.
If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one.
Name | Type | Description | |
---|---|---|---|
value | Vector3 | ||
min | Vector3 | ||
max | Vector3 |
Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
Name | Type | Description | |
---|---|---|---|
value1 | Vector3 | ||
tangent1 | Vector3 | ||
value2 | Vector3 | ||
tangent2 | Vector3 |
Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end".
Name | Type | Description | |
---|---|---|---|
start | Vector3 | ||
end | Vector3 | ||
amount | number |
Sets the passed vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end".
Name | Type | Description | |
---|---|---|---|
start | Vector3 | ||
end | Vector3 | ||
amount | number |
Returns the dot product (float) between the vectors "left" and "right".
Name | Type | Description | |
---|---|---|---|
left | Vector3 | ||
right | Vector3 |
Returns a new Vector3 as the cross product of the vectors "left" and "right".
The cross product is then orthogonal to both "left" and "right".
Name | Type | Description | |
---|---|---|---|
left | Vector3 | ||
right | Vector3 |
Sets the passed vector "result" with the cross product of "left" and "right".
The cross product is then orthogonal to both "left" and "right".
Name | Type | Description | |
---|---|---|---|
left | Vector3 | ||
right | Vector3 | ||
result | Vector3 |
Returns a new Vector3 as the normalization of the passed vector.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 |
Sets the passed vector "result" with the normalization of the passed first vector.
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
result | Vector3 |
Name | Type | Description | |
---|---|---|---|
vector | Vector3 | ||
world | Matrix | ||
transform | Matrix |
Name | Type | Description | |
---|---|---|---|
source | Vector3 | ||
viewportWidth | number | ||
viewportHeight | number | ||
world | Matrix |
Name | Type | Description | |
---|---|---|---|
source | Vector3 | ||
viewportWidth | number | ||
viewportHeight | number | ||
world | Matrix | ||
view | Matrix |
Name | Type | Description | |
---|---|---|---|
source | Vector3 | ||
viewportWidth | number | ||
viewportHeight | number | ||
world | Matrix | ||
view | Matrix | ||
projection | Matrix |
Name | Type | Description | |
---|---|---|---|
sourceX | float | ||
sourceY | float | ||
sourceZ | float | ||
viewportWidth | number | ||
viewportHeight | number | ||
world | Matrix | ||
view | Matrix | ||
projection | Matrix |
Name | Type | Description | |
---|---|---|---|
left | Vector3 | ||
right | Vector3 |
Name | Type | Description | |
---|---|---|---|
left | Vector3 | ||
right | Vector3 |
Returns the distance (float) between the vectors "value1" and "value2".
Name | Type | Description | |
---|---|---|---|
value1 | Vector3 | ||
value2 | Vector3 |
Returns the squared distance (float) between the vectors "value1" and "value2".
Name | Type | Description | |
---|---|---|---|
value1 | Vector3 | ||
value2 | Vector3 |
Returns a new Vector3 located at the center between "value1" and "value2".
Name | Type | Description | |
---|---|---|---|
value1 | Vector3 | ||
value2 | Vector3 |
Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
to something in order to rotate it from its local system to the given target system.
Note : axis1, axis2 and axis3 are normalized during this operation.
Returns a new Vector3.
Name | Type | Description | |
---|---|---|---|
axis1 | Vector3 | ||
axis2 | Vector3 | ||
axis3 | Vector3 |
The same than RotationFromAxis but updates the passed ref Vector3 parameter instead of returning a new Vector3.
Name | Type | Description | |
---|---|---|---|
axis1 | Vector3 | ||
axis2 | Vector3 | ||
axis3 | Vector3 |