Vec2

A vector object that holds two numbers.

Constructors

lovr.math.newVec2Create a new Vec2.
lovr.math.vec2Create a temporary Vec2.

Methods

Vec2:addAdd a vector or a number to the vector.
Vec2:distanceGet the distance to another vector.
Vec2:divDivides the vector by a vector or a number.
Vec2:dotGet the dot product with another vector.
Vec2:lengthGet the length of the vector.
Vec2:lerpMoves this vector some amount towards another one.
Vec2:mulMultiply the vector by a vector or a number.
Vec2:normalizeNormalize the length of the vector to 1.
Vec2:setSet the components of the vector.
Vec2:subSubtract a vector or a number from the vector.
Vec2:unpackGet the components of the vector.

See also