struct Vector2Int

book_4_sparkGenerated
code_blocksInput

Description

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.

Members

Static Members

Member NameSummary
MinReturns a vector with the minimum components from two vectors.
MaxReturns a vector with the maximum components from two vectors.
ParseParses a string to create a Vector2Int.
TryParseTries to parse a string to create a Vector2Int, returning a boolean indicating success.
OneAn integer vector with all components set to 1.
ZeroAn integer vector with all components set to 0.
RightAn integer vector with X set to 1, representing the right direction.
LeftAn integer vector with X set to -1, representing the left direction.
UpAn integer vector with Y set to 1, representing the up direction.
DownAn integer vector with Y set to -1, representing the down direction.

Instance Members

Member NameSummary
IsNearlyZeroChecks if the vector is nearly zero within a specified tolerance.
WriteWrites the vector to a binary writer.
ReadReads a vector from a binary reader.
ComponentMinReturns a vector with the minimum components compared to another vector.
ComponentMaxReturns a vector with the maximum components compared to another vector.
DistanceCalculates the distance to another vector.
SnapToGridSnaps the vector to a grid of a specified size.
AbsReturns a new vector with all values positive.
WithXReturns a new vector with a specified X component.
WithYReturns a new vector with a specified Y component.
NormalReturns a unit version of this vector as a Vector2.
DegreesReturns the angle of this vector in degrees.
ItemGets or sets the component at the specified index.
LengthGets the length (magnitude) of the vector.
LengthSquaredGets the squared length of the vector.
PerpendicularReturns a vector that is perpendicular to this one.
IsZeroLengthIndicates whether the length of this vector is zero.
xThe X component of this integer vector.
yThe Y component of this integer vector.