The Vector2Int struct represents a 2D vector with integer components. It provides various methods and properties to manipulate and interact with 2D integer vectors, commonly used in game development for grid-based calculations and operations.
The Vector2Int struct represents a 2D vector with integer components. It provides various methods and properties to manipulate and interact with 2D integer vectors, commonly used in game development for grid-based calculations and operations.
Member Name | Summary |
---|---|
Min | Returns a vector with the minimum components from two vectors. |
Max | Returns a vector with the maximum components from 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 length of this vector is zero. |
x | The X component of this integer vector. |
y | The Y component of this integer vector. |