Vector2

Constructors

this
this(float x, float y)

Members

Functions

angleTo
float angleTo(Vector2 vector)

Returns the angle to the vector in degrees

distanceTo
float distanceTo(Vector2 vector)

Returns the distance between the vectors

distanceToSquared
float distanceToSquared(Vector2 vector)

Returns the squared distance between the vectors

dot
float dot(Vector2 vector)

Returns the dot product of the two vectors

getDirection
float getDirection()

Returns the direction of the vector in degrees

getMagnitude
float getMagnitude()

Returns the magnitude of the vector

getNormalized
Vector2 getNormalized()

Returns a normalized copy of this vector

normalize
void normalize()

Normalizes the vector

opAdd
Vector2 opAdd(Vector2 vector)
opAdd
Vector3 opAdd(Vector3 vector)
opAddAssign
Vector2 opAddAssign(Vector2 vector)
opDiv
Vector2 opDiv(Vector2 vector)
opDiv
Vector2 opDiv(float a)
opDivAssign
Vector2 opDivAssign(Vector2 vector)
opDivAssign
Vector2 opDivAssign(float a)
opMul
Vector2 opMul(Vector2 vector)
opMul
Vector2 opMul(float a)
opMulAssign
Vector2 opMulAssign(Vector2 vector)
opMulAssign
Vector2 opMulAssign(float a)
opSub
Vector2 opSub(Vector2 vector)
opSub
Vector3 opSub(Vector3 vector)
opSubAssign
Vector2 opSubAssign(Vector2 vector)
opUnary
Vector2 opUnary()
set
void set(float x, float y)

Sets the values of x and y in a single statement

setDirection
void setDirection(float angle)

Sets the direction of the vector using degrees

setMagnitude
void setMagnitude(float magnitude)

Sets the magnitude of this vector

Static functions

random
Vector2 random()

Creates a normalized vector with a random direction

Variables

x
float x;
y
float y;

Meta