Table of Contents

Struct Vector2

Namespace
AO
Assembly
CoreAssembly.dll
public struct Vector2
Inherited Members
Extension Methods

Constructors

Vector2(float, float)

public Vector2(float x, float y)

Parameters

x float
y float

Fields

X

public float X

Field Value

float

Y

public float Y

Field Value

float

Properties

Down

public static Vector2 Down { get; }

Property Value

Vector2

Left

public static Vector2 Left { get; }

Property Value

Vector2

Length

Returns the length of the vector. √(X^2 + Y^2)

public float Length { get; }

Property Value

float

LengthSquared

Returns the squared length of the vector. X^2 + Y^2

public float LengthSquared { get; }

Property Value

float

Normalized

Returns the normalized or zero vector.

public Vector2 Normalized { get; }

Property Value

Vector2

One

public static Vector2 One { get; }

Property Value

Vector2

Right

public static Vector2 Right { get; }

Property Value

Vector2

Up

public static Vector2 Up { get; }

Property Value

Vector2

Zero

public static Vector2 Zero { get; }

Property Value

Vector2

Methods

Cross2DZ(Vector2, Vector2)

Computes the Z value of Cross(v3(a), v3(b)).

public static float Cross2DZ(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

float

Distance(Vector2, Vector2)

Computes the distance between two vectors.

public static float Distance(Vector2 a, Vector2 b)

Parameters

a Vector2

The first vector

b Vector2

The second vector

Returns

float

Distance between the two vectors

Dot(Vector2, Vector2)

Computes the dot product of 'a' and 'b'.

public static float Dot(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

float

Lerp(Vector2, Vector2, float)

Computes a linear interpolation between 'a' and 'b' by 't'.

public static Vector2 Lerp(Vector2 a, Vector2 b, float t)

Parameters

a Vector2

The start vector

b Vector2

The end vector

t float

The interpolation value

Returns

Vector2

Resulting vector

MoveToward(Vector2, Vector2, float)

Moves 'from' towards 'to' by delta, returning that new position and whether we arrived.

public static (Vector2, bool) MoveToward(Vector2 from, Vector2 to, float delta)

Parameters

from Vector2
to Vector2
delta float

Returns

(Vector2, bool)

Rotate(Vector2, float, Vector2)

Computes 'point' rotated by 'radians' about point 'pivot'.

public static Vector2 Rotate(Vector2 point, float radians, Vector2 pivot)

Parameters

point Vector2
radians float
pivot Vector2

Returns

Vector2

RoughlyEqual(Vector2, Vector2, float)

Returns true if the two vectors are roughly equal within the given tolerance.

public static bool RoughlyEqual(Vector2 a, Vector2 b, float tolerance = 0.0001)

Parameters

a Vector2
b Vector2
tolerance float

Returns

bool

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Unlerp(Vector2, Vector2, Vector2)

Computes the percentage that 'value' is between 'a' and 'b'.

public static Vector2 Unlerp(Vector2 a, Vector2 b, Vector2 value)

Parameters

a Vector2
b Vector2
value Vector2

Returns

Vector2

Operators

operator +(Vector2, Vector2)

public static Vector2 operator +(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator /(Vector2, Vector2)

public static Vector2 operator /(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator /(Vector2, float)

public static Vector2 operator /(Vector2 a, float b)

Parameters

a Vector2
b float

Returns

Vector2

operator ==(Vector2, Vector2)

public static bool operator ==(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

bool

operator !=(Vector2, Vector2)

public static bool operator !=(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

bool

operator *(Vector2, Vector2)

public static Vector2 operator *(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator *(Vector2, float)

public static Vector2 operator *(Vector2 a, float b)

Parameters

a Vector2
b float

Returns

Vector2

operator -(Vector2, Vector2)

public static Vector2 operator -(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Returns

Vector2

operator -(Vector2)

public static Vector2 operator -(Vector2 a)

Parameters

a Vector2

Returns

Vector2