Static
Readonly
BACKA Vector3 object that points backward. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
DOWNA Vector3 object that points down. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
FORWARDA Vector3 object that points forward. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
LEFTA Vector3 object that points left. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
ONEA Vector3 object with all one values. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
RIGHTA Vector3 object that points right. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
UPA Vector3 object that points up. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
X_A Vector3 object that points along the x-axis. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
Y_A Vector3 object that points along the y-axis. (See note in the Vector3.ZERO docs for important usage info.)
Static
Readonly
ZEROA static property to provide quick access to a Vector3 with all of its x,y,z components equal to zero. (Note: Be careful not to change the value of this field! It is marked readonly, but typescipt do not completely enforce this!)
// Good use of ZERO:
const p = new Vector3();
if (p.equals(Vector3.ZERO)) {
console.log("p is (0,0,0)")
}
// Dangerous use of ZERO!!!!
const p = Vector3.ZERO; // makes p a reference to Vector3.ZERO
p.add(new Vector3(1, 0, 0)); // changes Vector3.ZERO!
// Do this instead:
const p = Vector3.copy(Vector3.ZERO); // or "new Vector3();" or another function that returns a NEW Vector3 object
p.add(new Vector3(1, 0, 0));
Static
Readonly
Z_A Vector3 object that points along the z-axis. (See note in the Vector3.ZERO docs for important usage info.)
Checks if the x,y,z components of this Vector3 are equal (within a small value of epsilon) to those of the given Vector3.
A boolean value indicating if the Vector3 objects are equal
The Vector3 object to compare to
A small value of acceptable variance to account for numerical instability
Rotates this Vector3 instance by a given Quaternion
The Quaternion to rotate this Vector3
Static
addStatic
angleStatic
copyStatic
crossStatic
distanceStatic
divideStatic
divideStatic
dotStatic
equalsStatic
fuzzyStatic
inverseStatic
lerpStatic
multiplyStatic
multiplyStatic
normalizeStatic
reflectStatic
rotateRotates a Vector3 object by a Quaternion
A new Vector3 object that represents the result of rotating v by q
The Vector3 object to rotate
The Quaternion object to rotate the Vector3 by
Static
subtractStatic
transformStatic
transformGenerated using TypeDoc
This class holds the x,y,z components of a 3D point or vector. It includes linear algebra routines for working with vectors (e.g., dot product, cross product).
Most of the functions in the class are defined both as member functions that can be called on a specific instance of Vector3 and as static functions. The static functions return a new result, leaving the original inputs unchanged, whereas, in general, member functions save the result in this vector itself and return void: