top of page

Vector2Extensions

Extensions for Vector2.

Methods

AverageValues

(v.x + v.y) / 2.

SumValues

v.x + v.y.

MultiplyValues

v.x * v.y.

DivideValues

v.x / v.y.

SubtractValues

v.x - v.y.

AddToMe

Vector2(v1.x + v2.x, v1.y + v2.y).

SubtractFromMe

Vector2(v1.x - v2.x, v1.y - v2.y).

MultiplyMe

Vector2(v1.x * v2.x, v1.y * v2.y).

DivideMeBy

Vector2(v1.x / v2.x, v1.y / v2.y).

Abs

Vector2(Mathf.Abs(vector2.x), Mathf.Abs(vector2.y)).

Acos

Vector2(Mathf.Acos(vector2.x), Mathf.Acos(vector2.y)).

Asin

Vector2(Mathf.Asin(vector2.x), Mathf.Asin(vector2.y)).

Atan

Vector2(Mathf.Atan(vector2.x), Mathf.Abs(vector2.y)).

Ceil

Vector2(Mathf.Ceil(vector2.x), Mathf.Ceil(vector2.y)).

Clamp01

Vector2(Mathf.Clamp01(vector2.x), Mathf.Clamp01(vector2.y)).

Cos

Vector2(Mathf.Cos(vector2.x), Mathf.Cos(vector2.y)).

Exp

Vector2(Mathf.Exp(vector2.x), Mathf.Exp(vector2.y)).

Floor

Vector2(Mathf.Floor(vector2.x), Mathf.Floor(vector2.y)).

Log10

Vector2(Mathf.Log10(vector2.x), Mathf.Log10(vector2.y)).

Max

Mathf.Max(vector2.x, vector2.y).

Min

Mathf.Min(vector2.x, vector2.y).

Round

Vector2(Mathf.Round(vector2.x), Mathf.Round(vector2.y)).

Sign

Vector2(Mathf.Sign(vector2.x), Mathf.Sign(vector2.y)).

Sin

Vector2(Mathf.Sin(vector2.x), Mathf.Sin(vector2.y)).

Sqrt

Vector2(Mathf.Sqrt(vector2.x), Mathf.Sqrt(vector2.y)).

Tan

Vector2(Mathf.Tan(vector2.x), Mathf.Tan(vector2.y))

bottom of page