Constructors

Vector2Int Initializes an integer vector with given components.

Fields

x The X component of this integer vector.
y The Y component of this integer vector.

Properties

Degrees Return the angle of this vector in degrees, always between 0 and 360.
IsZeroLength Whether the length of this vector is zero or not.
Item
Length Length (or magnitude) of the integer vector (Distance from 0,0)
LengthSquared Squared length of the integer vector. This is faster than <see cref="P:Vector2Int.Length">Length</see>, and can be used for things like comparing distances, as long as only squared values are used."/>
Normal Returns a unit version of this vector. Keep in mind this returns a Vector2 and not a Vector2Int.
Perpendicular Returns an integer vector that runs perpendicular to this one.

Methods

Abs Returns a new integer vector with all values positive. -5 becomes 5, ect.
ComponentMax Returns an integer vector that has the maximum values on each axis of the two input vectors.
ComponentMin Returns an integer vector that has the minimum values on each axis of the two input vectors.
Distance Returns the distance between this vector and another.
IsNearlyZero Returns true if value on every axis is less than or equal to tolerance
Read
SnapToGrid Snap to grid along any of the 2 axes.
WithX Returns this integer vector with given X component.
WithY Returns this integer vector with given Y component.
Write

Static Fields

Down An integer vector with Y set to -1. This represents the down direction.
Left An integer vector with X set to -1. This represents the left direction.
One An integer vector with all components set to 1.
Right An integer vector with X set to 1. This represents the right direction.
Up An integer vector with Y set to 1. This represents the up direction.
Zero An integer vector with all components set to 0.

Static Methods

Max Returns an integer vector that has the maximum values on each axis between 2 given vectors.
Min Returns an integer vector that has the minimum values on each axis between 2 given vectors.
Parse Given a string, try to convert this into a Vector2Int. Example formatting is "x,y", "[x,y]", "x y", etc.
TryParse
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.