s&box docs

public sealed struct Vector2Int

Broader workflow and conceptual references connected to this API.

Constructors

Showing 4 constructors

Methods

Showing 16 methods

public Vector2Int Abs()

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

public Vector2Int ComponentMax(Vector2Int other)

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

public Vector2Int ComponentMin(Vector2Int other)

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

public bool IsNearlyZero(int tolerance = 0)

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

Parameters

  • tolerance: Default: 0

public Vector2Int Read(System.IO.BinaryReader reader)

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

Snap to grid along any of the 2 axes.

Parameters

  • sx: Default: True
  • sy: Default: True

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

public Vector2Int WithX(int x)

Returns this integer vector with given X component.

public Vector2Int WithY(int y)

Returns this integer vector with given Y component.

public void Write(System.IO.BinaryWriter writer)

Properties

Showing 7 properties

public float Vector2Int.Degrees { get; set; }

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

public bool Vector2Int.IsZeroLength { get; set; }

Whether the length of this vector is zero or not.

public float Vector2Int.Length { get; set; }

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

public int Vector2Int.LengthSquared { get; set; }

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."/>

public Vector2 Vector2Int.Normal { get; set; }

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

public Vector2Int Vector2Int.Perpendicular { get; set; }

Returns an integer vector that runs perpendicular to this one.

Metadata

FieldValue
Namespaceglobal
Typeclass
AssemblySandbox.System
Doc IDT: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