A 2-dimensional vector. Typically represents a position or size in 2D space.
A 2-dimensional vector. Typically represents a position or size in 2D space.
Member Name | Summary |
---|---|
FromRadians | Creates a Vector2 from an angle in radians. |
FromDegrees | Creates a Vector2 from an angle in degrees. |
DistanceBetween | Calculates the distance between two Vector2 points. |
DistanceBetweenSquared | Calculates the squared distance between two Vector2 points. |
DistanceSquared | Calculates the squared distance between two Vector2 points. |
Dot | Calculates the dot product of two Vector2 vectors. |
Lerp | Linearly interpolates between two Vector2 vectors. |
Min | Returns the component-wise minimum of two vectors. |
Max | Returns the component-wise maximum of two vectors. |
Parse | Parses a string to create a Vector2. |
TryParse | Tries to parse a string to create a Vector2. |
One | Returns a 2D vector with every component set to 1. |
Zero | Returns a 2D vector with every component set to 0. |
Up | Returns a 2D vector with Y set to 1, representing the upwards direction. |
Down | Returns a 2D vector with Y set to -1, representing the downwards direction. |
Left | Returns a 2D vector with X set to 1, representing the left direction. |
Right | Returns a 2D vector with X set to -1, representing the right direction. |
Random | Samples a random 2D position within a unit circle. |
Member Name | Summary |
---|---|
Distance | Calculates the distance to another Vector2. |
AlmostEqual | Checks if two vectors are approximately equal within a delta. |
SnapToGrid | Snaps the vector to a grid of a specified size. |
WithX | Returns a new vector with the X component set to a specified value. |
WithY | Returns a new vector with the Y component set to a specified value. |
LerpTo | Interpolates the vector towards a target vector. |
Clamp | Clamps the vector within specified minimum and maximum bounds. |
ComponentMin | Returns the component-wise minimum with another vector. |
ComponentMax | Returns the component-wise maximum with another vector. |
Abs | Returns a new vector with all values positive. |
Length | Returns the magnitude of the vector. |
LengthSquared | Returns the squared magnitude of the vector. |
Perpendicular | Returns a vector perpendicular to this one. |
IsNearZeroLength | Checks if the vector's length is near zero. |
Normal | Returns a normalized version of the vector. |
Degrees | Returns the angle of the vector in degrees. |
x | X component of this Vector. |
y | Y component of this Vector. |