Fields
x
The x component of the vector (read-only).
y
The y component of the vector (read-only).
Constructors
xy
origin
Returns the zero vector (0, 0).
scaleAndAdd
Returns a + b * scale.
scaleAndSub
Returns a - b * scale.
Static Functions
cross
Returns the cross product of two vectors (z-component of the 3D cross product).
Methods
length
Provides indexed access to the vector components.
Vector.length(v) instead for better performance.
lengthSquared
Returns the squared length of the vector.
Use Vector.lengthSquared(v) instead for better performance.
normalized
Returns a normalized copy of the vector. If the length is zero,
the result is the zero vector.
Use Vector.normalized(v) instead for better performance.
__eq
Returns true if the two vectors have equal components.
__unm
Returns the negated vector.
__add
Returns the sum of two vectors.
__sub
Returns the difference between two vectors.
__mul
Returns the vector scaled by the given number.
__div
Returns the vector divided by the given number.
distance
Returns the distance to the other vector.
Use Vector.distance(a, b) instead for better performance.
distanceSquared
Returns the squared distance to the other vector.
Use Vector.distanceSquared(a, b) instead for better performance.
dot
Returns the dot product of the vector and the other vector.
Use Vector.dot(a, b) instead for better performance.
lerp
Returns the linear interpolation between the vector and the other
vector, using t where 0 returns the vector and 1 returns the other.
Use Vector.lerp(a, b, t) instead for better performance.