The Vector2Int struct represents a 2D vector with integer components. It provides various methods and properties to perform operations on 2D integer vectors, such as calculating distances, snapping to grids, and parsing from strings.
The Vector2Int struct represents a 2D vector with integer components. It provides various methods and properties to perform operations on 2D integer vectors, such as calculating distances, snapping to grids, and parsing from strings.
Member Name | Summary |
---|---|
Min | Returns a vector with the minimum components of two vectors. |
Max | Returns a vector with the maximum components of two vectors. |
Parse | Parses a string to create a Vector2Int. |
TryParse | Tries to parse a string to create a Vector2Int, returning a boolean indicating success. |
One | An integer vector with all components set to 1. |
Zero | An integer vector with all components set to 0. |
Right | An integer vector with X set to 1, representing the right direction. |
Left | An integer vector with X set to -1, representing the left direction. |
Up | An integer vector with Y set to 1, representing the up direction. |
Down | An integer vector with Y set to -1, representing the down direction. |
Member Name | Summary |
---|---|
IsNearlyZero | Checks if the vector is nearly zero within a specified tolerance. |
Write | Writes the vector to a binary writer. |
Read | Reads a vector from a binary reader. |
ComponentMin | Returns a vector with the minimum components compared to another vector. |
ComponentMax | Returns a vector with the maximum components compared to another vector. |
Distance | Calculates the distance to another vector. |
SnapToGrid | Snaps the vector to a grid of a specified size. |
Abs | Returns a new vector with all values positive. |
WithX | Returns a new vector with a specified X component. |
WithY | Returns a new vector with a specified Y component. |
Normal | Returns a unit version of this vector as a Vector2. |
Degrees | Returns the angle of this vector in degrees. |
Item | Gets or sets the component at the specified index. |
Length | Gets the length (magnitude) of the vector. |
LengthSquared | Gets the squared length of the vector. |
Perpendicular | Returns a vector that is perpendicular to this one. |
IsZeroLength | Indicates whether the vector's length is zero. |
x | The X component of this integer vector. |
y | The Y component of this integer vector. |