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 vectors. |
Distance | Calculates the distance between two vectors (by reference). |
DistanceBetweenSquared | Calculates the squared distance between two vectors. |
DistanceSquared | Calculates the squared distance between two vectors (by reference). |
Dot | Calculates the dot product of two vectors. |
Lerp | Linearly interpolates between two vectors. |
Direction | Calculates the direction from one vector to another. |
Parse | Parses a string to create a Vector2. |
TryParse | Tries to parse a string to create a Vector2. |
Min | Returns the component-wise minimum of two vectors. |
Max | Returns the component-wise maximum of two vectors. |
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 vector. |
DistanceSquared | Calculates the squared distance to another vector. |
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 a specified X value. |
WithY | Returns a new vector with a specified Y value. |
LerpTo | Interpolates the vector towards a target vector. |
Clamp | Clamps the vector within a specified range. |
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. |
x | X component of this Vector. |
y | Y component of this Vector. |
Length | Returns the magnitude of the vector. |
LengthSquared | Returns the squared magnitude of the vector. |
Perpendicular | Returns a vector that runs perpendicular to this one. |
IsNearZeroLength | Returns true if the squared length is near zero. |
Normal | Returns the normalized vector. |
Degrees | Returns the angle of this vector in degrees. |