Staticaddadd
Add two vectors to produce a new vector
Staticclampclamp
Clamps the components of a vector to limits to produce a new vector
Optionallimits: { max?: Partial<Vector2>; min?: Partial<Vector2> }Staticdistancedistance
Calculate the distance between two vectors
Staticdotdot
Calculate the dot product of two vectors
Staticequalsequals
Check the equality of two vectors
Staticfloorfloor
Floor the components of a vector to produce a new vector
StaticfromfromString
Gets a Vector2 from the string representation produced by Vector2Utils.toString. If any numeric value is not a number or the format is invalid, undefined is returned.
The string to parse
Optionaldelimiter: stringThe delimiter used to separate the components. Defaults to the same as the default for Vector2Utils.toString
Staticlerplerp
Constructs a new vector using linear interpolation on each component from two vectors.
Staticmagnitudemagnitude
The magnitude of a vector
Staticmultiplymultiply
Element-wise multiplication of two vectors together. Not to be confused with Vector2Utils.dot product
Staticnormalizenormalize
Takes a vector 3 and normalizes it to a unit vector
Staticscalescale
Multiple all entries in a vector by a single scalar value producing a new vector
Staticslerpslerp
Constructs a new vector using spherical linear interpolation on each component from two vectors.
Staticsubtractsubtract
Subtract two vectors to produce a new vector (v1-v2)
StatictotoString
Create a string representation of a vector2
Optionaloptions: { decimals?: number; delimiter?: string }
Utilities operating on Vector2 objects. All methods are static and do not modify the input objects.