Skip to content

vec3_t

local vec = vec3_t(100, 100, 100)
print(vec)

Fields#

Field Description
x
float
y
float
z
float

Operators#

local x = vec3_t(60, 100, 0)
local y = vec3_t(50, 50, 0)

print(x) -- prints formatted
print(x[2]) -- prints y
x[2] = 40 -- sets y to 40
print(x == y) -- prints if x is equal to y
print(x + y) -- prints result of addition
print(x - y) -- prints result of subtraction
print(x / y) -- prints result of division
print(x * y) -- prints result of multiplication
print(-x) -- prints result of inversed x
print(#x) -- prints length of x

Functions#

normalize#

noramlizes the current vector

void normalize()

normalized#

returns a normalized avector and leaves the current vector untouched

vec3_t normalized()

length#

returns the length of vector

float length()

length2d#

returns the 2d length of vector

float length2d()

cross#

returns the cross product between two vectors

vec3_t cross(<vec3_t> other)

dot#

returns the dot product between two vectors

float dot(<vec3_t> other)

inverse#

returns the inverse of the vector

vec3_t inverse()

dist#

returns the distance between two vectors

float dist(<vec3_t> other)

scale#

scales the current vector

void scale(<float> scalar)

scaled#

returns a scaled vector but leaves the current vector untouched

vec3_t scaled(<float> scalar)

to_angle#

converts the vector to an angle

angle_t to_angle()

as_angle#

returns the current vector as an angle but doesnt convert it

angle_t as_angle()

calc_angle_to#

returns the angle to another vector

angle_t calc_angle_to(<vec3_t> other)

is_zero#

returns if the vector is zero

bool is_zero()

zero#

sets all coords to zero

void zero()

unpack#

returns all individual coords

float, float, float unpack()