Optionalx: number | Vector2LikeThe x component, or an object with x and y properties. Default 0.
Optionaly: numberThe y component. Default x.
The x component of this Vector.
The y component of this Vector.
Static ReadonlyDOWNA static down Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyLEFTA static left Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyONEA static one Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyRIGHTA static right Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyUPA static up Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyZEROA static zero Vector2 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Add a given Vector to this Vector. Addition is component-wise.
The Vector to add to this Vector.
Calculate the angle between this Vector and the positive x-axis, in radians.
Copy the components of a given Vector into this Vector.
The Vector to copy the components from.
Calculate the cross product of this Vector and the given Vector.
The Vector2 to cross with this Vector2.
Calculate the distance between this Vector and the given Vector.
The Vector to calculate the distance to.
Calculate the distance between this Vector and the given Vector, squared.
The Vector to calculate the distance to.
Perform a component-wise division between this Vector and the given Vector.
Divides this Vector by the given Vector.
The Vector to divide this Vector by.
Calculate the dot product of this Vector and the given Vector.
The Vector2 to dot product with this Vector2.
Check whether this Vector is equal to a given Vector.
Performs a strict equality check against each Vector's components.
The vector to compare with this Vector.
Check whether this Vector is approximately equal to a given Vector.
The vector to compare with this Vector.
Optionalepsilon: numberThe tolerance value. Default 0.0001.
Calculate the length (or magnitude) of this Vector.
Calculate the length of this Vector squared.
Linearly interpolate between this Vector and the given Vector.
Interpolates this Vector towards the given Vector.
The Vector2 to interpolate towards.
Optionalt: numberThe interpolation percentage, between 0 and 1. Default 0.
Perform a component-wise multiplication between this Vector and the given Vector.
Multiplies this Vector by the given Vector.
The Vector to multiply this Vector by.
Set the component values of this Vector from a given Vector2Like object.
The object containing the component values to set for this Vector.
Subtract the given Vector from this Vector. Subtraction is component-wise.
The Vector to subtract from this Vector.
A representation of a vector in 2D space.
A two-component vector.