Class Vector2
A pure .NET implemenation of Unity's Vector2.
See Unity's docs for more details.
Inheritance
System.Object
Vector2
Assembly: Sylves.dll
Syntax
public sealed class Vector2 : ValueType
Constructors
Vector2(Single, Single)
Declaration
public Vector2(float x, float y)
Parameters
Type |
Name |
Description |
System.Single |
x |
|
System.Single |
y |
|
Properties
down
Declaration
public static Vector2 down { get; }
Property Value
Item[Int32]
Declaration
public float this[int index] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
Property Value
Type |
Description |
System.Single |
|
left
Declaration
public static Vector2 left { get; }
Property Value
magnitude
Declaration
public float magnitude { get; }
Property Value
Type |
Description |
System.Single |
|
negativeInfinity
Declaration
public static Vector2 negativeInfinity { get; }
Property Value
normalized
Declaration
public Vector2 normalized { get; }
Property Value
one
Declaration
public static Vector2 one { get; }
Property Value
positiveInfinity
Declaration
public static Vector2 positiveInfinity { get; }
Property Value
right
Declaration
public static Vector2 right { get; }
Property Value
sqrMagnitude
Declaration
public float sqrMagnitude { get; }
Property Value
Type |
Description |
System.Single |
|
up
Declaration
public static Vector2 up { get; }
Property Value
x
Declaration
public float x { get; set; }
Property Value
Type |
Description |
System.Single |
|
y
Declaration
public float y { get; set; }
Property Value
Type |
Description |
System.Single |
|
zero
Declaration
public static Vector2 zero { get; }
Property Value
Methods
Angle(Vector2, Vector2)
Declaration
public static float Angle(Vector2 from, Vector2 to)
Parameters
Returns
Type |
Description |
System.Single |
|
ClampMagnitude(Vector2, Single)
Declaration
public static Vector2 ClampMagnitude(Vector2 vector, float maxLength)
Parameters
Type |
Name |
Description |
Vector2 |
vector |
|
System.Single |
maxLength |
|
Returns
Distance(Vector2, Vector2)
Declaration
public static float Distance(Vector2 a, Vector2 b)
Parameters
Returns
Type |
Description |
System.Single |
|
Dot(Vector2, Vector2)
Declaration
public static float Dot(Vector2 a, Vector2 b)
Parameters
Returns
Type |
Description |
System.Single |
|
Equals(Vector2)
Declaration
public bool Equals(Vector2 other)
Parameters
Type |
Name |
Description |
Vector2 |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object other)
Parameters
Type |
Name |
Description |
System.Object |
other |
|
Returns
Type |
Description |
System.Boolean |
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Lerp(Vector2, Vector2, Single)
Declaration
public static Vector2 Lerp(Vector2 a, Vector2 b, float t)
Parameters
Returns
LerpUnclamped(Vector2, Vector2, Single)
Declaration
public static Vector2 LerpUnclamped(Vector2 a, Vector2 b, float t)
Parameters
Returns
Magnitude(Vector2)
Declaration
public static float Magnitude(Vector2 a)
Parameters
Returns
Type |
Description |
System.Single |
|
Max(Vector2, Vector2)
Declaration
public static Vector2 Max(Vector2 lhs, Vector2 rhs)
Parameters
Returns
Min(Vector2, Vector2)
Declaration
public static Vector2 Min(Vector2 lhs, Vector2 rhs)
Parameters
Returns
MoveTowards(Vector2, Vector2, Single)
Declaration
public static Vector2 MoveTowards(Vector2 current, Vector2 target, float maxDistanceDelta)
Parameters
Type |
Name |
Description |
Vector2 |
current |
|
Vector2 |
target |
|
System.Single |
maxDistanceDelta |
|
Returns
Normalize()
Declaration
Perpendicular(Vector2)
Declaration
public static Vector2 Perpendicular(Vector2 inDirection)
Parameters
Type |
Name |
Description |
Vector2 |
inDirection |
|
Returns
Reflect(Vector2, Vector2)
Declaration
public static Vector2 Reflect(Vector2 inDirection, Vector2 inNormal)
Parameters
Returns
Scale(Vector2)
Declaration
public void Scale(Vector2 scale)
Parameters
Type |
Name |
Description |
Vector2 |
scale |
|
Scale(Vector2, Vector2)
Declaration
public static Vector2 Scale(Vector2 a, Vector2 b)
Parameters
Returns
Set(Single, Single)
Declaration
public void Set(float newX, float newY)
Parameters
Type |
Name |
Description |
System.Single |
newX |
|
System.Single |
newY |
|
SignedAngle(Vector2, Vector2)
Declaration
public static float SignedAngle(Vector2 from, Vector2 to)
Parameters
Returns
Type |
Description |
System.Single |
|
SqrMagnitude()
Declaration
public float SqrMagnitude()
Returns
Type |
Description |
System.Single |
|
SqrMagnitude(Vector2)
Declaration
public static float SqrMagnitude(Vector2 a)
Parameters
Returns
Type |
Description |
System.Single |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
ToString(String)
Declaration
public string ToString(string format)
Parameters
Type |
Name |
Description |
System.String |
format |
|
Returns
Type |
Description |
System.String |
|
Operators
Addition(Vector2, Vector2)
Declaration
public static Vector2 operator +(Vector2 a, Vector2 b)
Parameters
Returns
Division(Vector2, Vector2)
Declaration
public static Vector2 operator /(Vector2 a, Vector2 b)
Parameters
Returns
Division(Vector2, Single)
Declaration
public static Vector2 operator /(Vector2 a, float b)
Parameters
Type |
Name |
Description |
Vector2 |
a |
|
System.Single |
b |
|
Returns
Equality(Vector2, Vector2)
Declaration
public static bool operator ==(Vector2 lhs, Vector2 rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(Vector2, Vector2)
Declaration
public static bool operator !=(Vector2 lhs, Vector2 rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Multiply(Vector2, Vector2)
Declaration
public static Vector2 operator *(Vector2 a, Vector2 b)
Parameters
Returns
Multiply(Vector2, Single)
Declaration
public static Vector2 operator *(Vector2 a, float b)
Parameters
Type |
Name |
Description |
Vector2 |
a |
|
System.Single |
b |
|
Returns
Multiply(Single, Vector2)
Declaration
public static Vector2 operator *(float a, Vector2 b)
Parameters
Type |
Name |
Description |
System.Single |
a |
|
Vector2 |
b |
|
Returns
Subtraction(Vector2, Vector2)
Declaration
public static Vector2 operator -(Vector2 a, Vector2 b)
Parameters
Returns
UnaryNegation(Vector2)
Declaration
public static Vector2 operator -(Vector2 a)
Parameters
Returns