Vector2Intclass

object→Vector2Int
Namespace
global
Assembly
Sandbox.System
Declaration
public sealed struct Vector2Int

Constructors4

Showing 4 constructors

Methods16

Showing 16 methods

public Vector2Int Abs()PUBLIC

Returns a new integer vector with all values positive. -5 becomes 5, ect.

Returns:Vector2Int—

public Vector2Int ComponentMax(Vector2Int other)PUBLIC

Returns an integer vector that has the maximum values on each axis of the two input vectors.

ParameterTypeDescription
otherVector2Int—
Returns:Vector2Int—

public Vector2Int ComponentMin(Vector2Int other)PUBLIC

Returns an integer vector that has the minimum values on each axis of the two input vectors.

ParameterTypeDescription
otherVector2Int—
Returns:Vector2Int—

public bool IsNearlyZero(int tolerance = 0)PUBLIC

Returns true if value on every axis is less than or equal to tolerance

ParameterTypeDescription
tolerance = 0int—
Returns:bool—

public Vector2Int Read(System.IO.BinaryReader reader)PUBLIC

ParameterTypeDescription
readerBinaryReader—
Returns:Vector2Int—

public Vector2Int SnapToGrid(int gridSize, bool sx = True, bool sy = True)PUBLIC

Snap to grid along any of the 2 axes.

ParameterTypeDescription
gridSizeint—
sx = Truebool—
sy = Truebool—
Returns:Vector2Int—

public static override bool TryParse(string str, System.IFormatProvider info, Vector2Int result)PUBLICSTATICOVERRIDE

ParameterTypeDescription
strstring—
infoIFormatProvider—
resultVector2Int—
Returns:bool—

public Vector2Int WithX(int x)PUBLIC

Returns this integer vector with given X component.

ParameterTypeDescription
xint—
Returns:Vector2Int—

public Vector2Int WithY(int y)PUBLIC

Returns this integer vector with given Y component.

ParameterTypeDescription
yint—
Returns:Vector2Int—

public void Write(System.IO.BinaryWriter writer)PUBLIC

ParameterTypeDescription
writerBinaryWriter—
Returns:void—

Properties7

Showing 7 properties

public float Vector2Int.Degrees { get; set; }PUBLICGETSET

Return the angle of this vector in degrees, always between 0 and 360.

Returns:float—

public bool Vector2Int.IsZeroLength { get; set; }PUBLICGETSET

Whether the length of this vector is zero or not.

Returns:bool—

public float Vector2Int.Length { get; set; }PUBLICGETSET

Length (or magnitude) of the integer vector (Distance from 0,0)

Returns:float—

public int Vector2Int.LengthSquared { get; set; }PUBLICGETSET

Squared length of the integer vector. This is faster than Length, and can be used for things like comparing distances, as long as only squared values are used."/>

Returns:int—

public Vector2 Vector2Int.Normal { get; set; }PUBLICGETSET

Returns a unit version of this vector. Keep in mind this returns a Vector2 and not a Vector2Int.

Returns:Vector2—

public Vector2Int Vector2Int.Perpendicular { get; set; }PUBLICGETSET

Returns an integer vector that runs perpendicular to this one.

Returns:Vector2Int—

On this page

Constructorspublic Vector2Int(System.Int32 x, System.Int32 y)public Vector2Int(System.Int32 all = 0)public Vector2Int(Vector2Int vector2Int)public Vector2Int(Vector3Int vector3Int)Methodspublic Vector2Int Abs()public Vector2Int ComponentMax(Vector2Int other)public Vector2Int ComponentMin(Vector2Int other)public System.Single Distance(Vector2 other)public System.Single Distance(Vector2Int other)public System.Boolean IsNearlyZero(System.Int32 tolerance = 0)public static Vector2Int Max(Vector2Int a, Vector2Int b)public static Vector2Int Min(Vector2Int a, Vector2Int b)public static override Vector2Int Parse(System.String str, System.IFormatProvider provider)public static Vector2Int Parse(System.String str)public Vector2Int Read(System.IO.BinaryReader reader)public Vector2Int SnapToGrid(System.Int32 gridSize, System.Boolean sx = True, System.Boolean sy = True)public static override System.Boolean TryParse(System.String str, System.IFormatProvider info, Vector2Int result)public Vector2Int WithX(System.Int32 x)public Vector2Int WithY(System.Int32 y)public System.Void Write(System.IO.BinaryWriter writer)Propertiespublic System.Single Vector2Int.Degrees { get; set; }public System.Boolean Vector2Int.IsZeroLength { get; set; }public System.Int32 Vector2Int.Item { get; set; }public System.Single Vector2Int.Length { get; set; }public System.Int32 Vector2Int.LengthSquared { get; set; }public Vector2 Vector2Int.Normal { get; set; }public Vector2Int Vector2Int.Perpendicular { get; set; }Metadata