Vector2¶
Vector2 is a 2D vector with an x and y component.
Not newable
This object cannot be created by scripts using Instance.New().
Properties¶
X : number¶
The X component of the vector.
Y : number¶
The Y component of the vector.
Down : Vector2¶
Shorthand for Vector2.New(0, -1).
Left : Vector2¶
Shorthand for Vector2.New(-1, 0).
One : Vector2¶
Shorthand for Vector2.New(1, 1).
Zero : Vector2¶
Shorthand for Vector2.New(0, 0).
Right : Vector2¶
Shorthand for Vector2.New(1, 0).
Up : Vector2¶
Shorthand for Vector2.New(0, 1).
Magnitude : number¶
The length of the vector.
Normalized : Vector2¶
The normalized version of the vector.
SqrMagnitude : number¶
The squared length of the vector.
Methods¶
New → Vector2¶
Parameters: ``
Returns a new Vector2 with the given x and y components.
New → Vector2¶
Parameters: d [ number ]
Returns a new Vector2 with the given x and y components.
New → Vector2¶
Parameters
x [ number ]
y [ number ]
Returns a new Vector2 with the given x and y components.
Angle → number¶
Returns the angle in degrees between from and to.
Cross → Vector2¶
Returns the cross product of lhs and rhs.
Distance → number¶
Returns the distance between a and b.
Dot → number¶
Returns the dot product of lhs and rhs.
Lerp → Vector2¶
Returns a new vector that is the linear interpolation between a and b by t.
Max → Vector2¶
Returns a vector that is made from the largest components of two vectors.
Min → Vector2¶
Returns a vector that is made from the smallest components of two vectors.
MoveTowards → Vector2¶
Calculate a position between the points specified by current and target, moving no farther than the distance specified by maxDistanceDelta.
Normalize → Vector2¶
Parameters: value [ Vector2 ]
Returns a new Vector2 that is the normalized version of the given vector.
Project → Vector2¶
Returns the projection of a vector onto another vector.
Reflect → Vector2¶
Returns the reflection of a vector off the plane defined by a normal.
Slerp → Vector2¶
Spherically interpolates between two vectors.