Fields
x
The x component of the vector (read-only).
y
The y component of the vector (read-only).
Constructors
xy
Creates a vector with the specified x and y components.
origin
Returns the zero vector (0, 0).
scaleAndAdd
Returns a + b * scale.
scaleAndSub
Returns a - b * scale.
lerp
Returns the linear interpolation between the to and from
vector, using t where 0 returns the vector and 1 returns the other.
normalized
Returns a normalized copy of the given vector.
Static Functions
distance
Returns the distance between the two vectors.
distanceSquared
Returns the squared distance between the two vectors.
dot
Returns the dot product of the two vectors.
cross
Returns the cross product of two vectors (z-component of the 3D cross product).
length
Returns the length of the given vector.
lengthSquared
Returns the squared length of the given vector.
Methods
length
Returns the length of the vector.
use Vector.length(v) instead.
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.