x component of the vector
y component of the vector
Optionalz: numberoptional. The z component of the vector
↗ The x component of the vector.
↗ The y component of the vector.
↗ The z component of the vector, if applicable.
↗ Calculates the distance between this vector and another vector.
other vector
distance
↗ Calculates the dot product of this vector and another vector.
other vector
dot product
↗ Calculates the angle of rotation for this vector (only 2D vectors).
angle of rotation
↗ Limits the magnitude of the vector to the value used for the max parameter.
maximum magnitude for the vector
this vector after limiting
↗ Calculates the magnitude (length) of the vector.
magnitude of the vector
↗ Normalizes the vector to a length of 1 (making it a unit vector).
this vector after normalization
↗ Rotates the vector by the given angle (only 2D vectors).
angle of rotation in radians
this vector after rotation
↗ Sets the components of the vector.
x component
y component
Optionalz: numberoptional. The z component
↗ Rotates the vector to a specific angle without changing its magnitude.
angle in radians
this vector after setting the heading
↗ Sets the magnitude of the vector to the specified length.
new length of the vector
this vector after setting magnitude
↗ Linearly interpolates between this vector and another vector, including the magnitude.
vector to interpolate towards
amount of interpolation; a number between 0.0 (close to the current vector) and 1.0 (close to the target vector)
this vector after spherical interpolation
StaticfromOptionallength: number
↗ Constructs a new Vector object.