Vector2

More information can be found in the Unity API Reference

Constructors

Constructor

Description

Vector2()

Vector2(x, y)

Members

Member

Description

magnitude

normalized

sqrMagnitude

x

y

Methods

Method

Description

GetHashCode()

Normalize()

Scale(scale)

Set(newX, newY)

SqrMagnitude()

ToString()

ToString(format)

Static members

Member

Description

down

kEpsilon

kEpsilonNormalSqrt

left

negativeInfinity

one

positiveInfinity

right

up

zero

Static methods

Method

Description

Angle(from, to)

ClampMagnitude(vector, maxLength)

Distance(a, b)

Dot(lhs, rhs)

Lerp(a, b, t)

LerpUnclamped(a, b, t)

Max(lhs, rhs)

Min(lhs, rhs)

MoveTowards(current, target, maxDistanceDelta)

Perpendicular(inDirection)

Reflect(inDirection, inNormal)

Scale(a, b)

SignedAngle(from, to)

SmoothDamp(current, target, currentVelocity, smoothTime)

SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed)

SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime)

SqrMagnitude(a)

Operators

Operator

Description

operator -(a)

operator -(a, b)

operator !=(lhs, rhs)

operator *(a, b)

operator *(a, d)

operator *(d, a)

operator /(a, b)

operator /(a, d)

operator +(a, b)

operator ==(lhs, rhs)

Details

class Vector2
Vector2 Vector2(float x, float y)
Vector2 Vector2()
const float magnitude
const Vector2 normalized
const float sqrMagnitude
float x
float y
int GetHashCode()
void Normalize()
void Scale(Vector2 scale)
void Set(float newX, float newY)
float SqrMagnitude()
string ToString()
string ToString(string format)
static const Vector2 down
static const float kEpsilon
static const float kEpsilonNormalSqrt
static const Vector2 left
static const Vector2 negativeInfinity
static const Vector2 one
static const Vector2 positiveInfinity
static const Vector2 right
static const Vector2 up
static const Vector2 zero
static float Angle(Vector2 from, Vector2 to)
static Vector2 ClampMagnitude(Vector2 vector, float maxLength)
static float Distance(Vector2 a, Vector2 b)
static float Dot(Vector2 lhs, Vector2 rhs)
static Vector2 Lerp(Vector2 a, Vector2 b, float t)
static Vector2 LerpUnclamped(Vector2 a, Vector2 b, float t)
static Vector2 Max(Vector2 lhs, Vector2 rhs)
static Vector2 Min(Vector2 lhs, Vector2 rhs)
static Vector2 MoveTowards(Vector2 current, Vector2 target, float maxDistanceDelta)
static Vector2 Perpendicular(Vector2 inDirection)
static Vector2 Reflect(Vector2 inDirection, Vector2 inNormal)
static Vector2 Scale(Vector2 a, Vector2 b)
static float SignedAngle(Vector2 from, Vector2 to)
static Vector2 SmoothDamp(Vector2 current, Vector2 target, Vector2 currentVelocity, float smoothTime)
static Vector2 SmoothDamp(Vector2 current, Vector2 target, Vector2 currentVelocity, float smoothTime, float maxSpeed)
static Vector2 SmoothDamp(Vector2 current, Vector2 target, Vector2 currentVelocity, float smoothTime, float maxSpeed, float deltaTime)
static float SqrMagnitude(Vector2 a)
static Vector2 operator-(Vector2 a)
static Vector2 operator-(Vector2 a, Vector2 b)
static bool operator!=(Vector2 lhs, Vector2 rhs)
static Vector2 operator*(Vector2 a, Vector2 b)
static Vector2 operator*(Vector2 a, float d)
static Vector2 operator*(float d, Vector2 a)
static Vector2 operator/(Vector2 a, Vector2 b)
static Vector2 operator/(Vector2 a, float d)
static Vector2 operator+(Vector2 a, Vector2 b)
static bool operator==(Vector2 lhs, Vector2 rhs)