Optionalx: numberOptionaly: numberOptionalz: numberProtected_Protected_Protected_Static ReadonlyoneA Vector with all components set to one.
Static ReadonlyxA Vector with the X component set to one and Y and Z set to zero.
Static ReadonlyyA Vector with the Y component set to one and X and Z set to zero.
Static ReadonlyzA Vector with the Z component set to one and X and Y set to zero.
Static ReadonlyzeroA Vector with all components set to zero.
Gets the number of elements in this vector.
Determines if this instance is zero length.
Returns a copy of the current vector added by the given components.
Returns a copy of the current vector added by the given scalar.
Clones this instance and returns a new Vector3 with identical values.
Adds the specified components to the vector.
Clears all elements of the vector to zero.
Performs scalar multiplication of this vector and returns it.
Negates this instance and returns itself.
Normalizes the vector.
Evaluates the expression and assigns it to the vector.
The expression to evaluate.
A reference to this vector
MathEx.eval for detailed documentation, limitations and considerations.
Accesses a specific component of the vector.
Index of the component.
Value of the specific component.
Gets the maximum element (non absolute).
Returns whether the provided vector, given a error margin, has the same vector components values as this one.
True if equal, false otherwise.
Computes the length of the vector.
Returns the squared length of the vector.
Gets a negated copy of this instance.
Returns a normalized copy of the vector.
Assigns the value to the element at the specified index.
Sets a specific component of the vector.
Index of the component.
The value to set.
Assigns the specified values.
Returns a copy of the current vector subtracted by the given vector.
Converts this instance to an array with 3 elements.
Optionaldigits: numberReturns a string representation of an object.
StaticaddStaticaddStaticaddStaticaddStaticangleStaticcrossStaticdistanceStaticdivideStaticdivideStaticdotStaticisCompares two 3D vectors with an error margin.
True if equal, false otherwise.
StaticisStaticlengthStaticlerpStaticmagnitudeStaticmaxStaticminStaticmultiplyStaticmultiplyStaticorthogonalStaticorthonormalizeStaticsubtractStaticsubtract
The Vector3 implements a fixed-size three-dimensional vector. The class follows the 'copy-on-write' pattern, which means that every operation such as Vector3#normalized or Vector3.add returns a copy of the vector with updates values. It also implies that the values of the vector cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.