0
0
0
Read-only flag to check if a given object is of type Vector.
Read-only flag to check if a given object is of type Vector3.
Applies a Quaternion transform to this vector.
This instance.
Restrict this vector component values to the range of their respective min and max vector component values.
If this vector's x, y or z value is greater than the max vector's x, y or z value, it is replaced by the corresponding value.
If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value.
This instance.
Restrict this vector length the range [min,max].
If this vector's length is greater than the max value, the vector will be scaled down so its length is the max value.
If this vector's length is less than the min value, the vector will be scaled up so its length is the min value.
This instance.
The minimum value the length will be clamped to
The maximum value the length will be clamped to
Restrict this vector component values to the range [minVal,maxVal].
If this vector's x, y or z values are greater than the max value, they are replaced by the max value.
If this vector's x, y or z values are less than the min value, they are replaced by the min value.
This instance.
The minimum component value
The maximum component value
Computes the squared distance from this vector to v. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate.
The squared distance.
Sets this vector's x value to be array[ offset + 0 ], y value to be array[ offset + 1 ] and z value to be array[ offset + 2 ].
This instance.
The source array.
Optional
offset: numberOffset into the array.
Get a component value by index, [x,y,z]. If index equals 0 returns the x value. If index equals 1 returns the y value. If index equals 2 returns the z value.
The x, y or z component specified by index.
Index of component to access.
Computes the square of the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
The sum of the components squared.
Linearly interpolate between this vector and v, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.
This instance.
The vector to interpolate towards.
The interpolation factor, typically in the closed interval [0, 1].
Sets this vector to be the vector linearly interpolated between v1 and v2 where alpha is the percent distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2.
This instance.
Sets this vector from the cylindrical coordinates c.
This instance.
Returns an array [x, y, z], or copies x, y and z into the provided array.
Array with this vector compoonent values, [x,y,z].
Optional
array: number[] | Vector3TupleArray to store this vector to. If this is not provided a new array will be created.
Optional
offset: numberOptional offset into the array.
Represents a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used to represent a number of things, such as:
There are other things a 3D vector can be used to represent, such as momentum vectors and so on.
Iterating through a Vector3 instance will yield its components (x, y, z) in the corresponding order.
Example