Skip to content

vec3


Constructors

Return Arguments
vec3 -
vec3 float, float, float

Metamethods

Name Return Arguments
__eq bool vec3
__lt bool vec3
__le bool vec3
__add vec3 float|vec3
__sub vec3 float|vec3
__mul vec3 float|vec3
__div vec3 float|vec3
__idiv vec3 float|vec3

Members

Name Type
x float
y float
z float

dot

float vec3.dot(vec3 other)

Returns the dot product of two vectors
Example Usage
local dot = vec:dot(other_vec)

cross

vec3 vec3.cross(vec3 other)

Returns the cross product of two vectors
Example Usage
local cross = vec:cross(other_vec)

to_radians

void vec3.to_radians()

Converts a rotation vector from degrees to radians
Example Usage
vec:to_radians()

to_degrees

void vec3.to_degrees()

Converts a rotation vector from radians to degrees
Example Usage
vec:to_degrees()

distance_to

float vec3.distance_to(vec3 other)

Returns the distance between two vectors
Example Usage
local dist = vec:distance_to(other_vec)

magnitude

float vec3.magnitude()

Returns the magnitude of a vector
Example Usage
local mag = vec:magnitude()

min_component

float vec3.min_component()

Returns the smallest component of a vector
Example Usage
local min = vec:min_component()

max_component

float vec3.max_component()

Returns the largest component of a vector
Example Usage
local max = vec:max_component()

normalize

void vec3.normalize()

Converts a vector to a unit vector
Example Usage
vec:normalize()

is_null

bool vec3.is_null()

Returns true if all components of a vector are 0.0
Example Usage
local null = vec:is_null()