Optional
x: number = 0The x coordinate of the vector.
Optional
y: number = 0The y coordinate of the vector.
Static
Readonly
NegA unit vector pointing in the negative x-axis.
Static
Readonly
NegA unit vector pointing in the nega y-axis.
Static
Readonly
XA unit vector pointing in the x-axis.
Static
Readonly
YA unit vector pointing in the y-axis.
Static
Readonly
ZeroA vector whose x and y values will remain 0.
Returns a copy of this.
Returns the distance between this vector and another vector.
The other vector.
Returns the squared distance between this vector and another vector.
The other vector.
Returns length of this vector.
Returns the length squared of this vector.
Multiplies a scalar value with this vector's component values.
Makes this a unit vector.
Negates the values of this vector.
Subtracts a scalar value from this vector's component values.
Static
addStatic
addStatic
angleStatic
clampStatic
copyStatic
crossStatic
crossStatic
distanceStatic
distanceStatic
divideStatic
divideStatic
dotStatic
equalStatic
fromStatic
invertStatic
lerpStatic
magnitudeStatic
magnitudeStatic
multiplyStatic
multiplyStatic
normalStatic
normalizeStatic
randomStatic
reflectStatic
reverseStatic
rotateStatic
rotateStatic
setStatic
setStatic
splatStatic
subtractStatic
subtractStatic
toReturns the angle in radians between the positive x-axis and the vector.
This is a 2D vector class.