vec3
math.vec3
Variables
x - number
y - number
z - number
Supported operators:
+, -, /, *
Functions
unpack
local vector = math.vec3(1, 2, 3)local x, y, z = vector:unpack()
Returns:
x
number
y
number
z
number
length
local vector = math.vec3(1, 0, 0)vector:length()
Returns:
number
length2d
local vector = math.vec3(1, 0, 0)vector:length2d()
Returns:
number
dist
local vector = math.vec3(1, 0, 0)local vector2 = math.vec3(5, 5, 5)print(vector:dist(vector2))
other vector
math.vec3
vector to calculate distance
Returns:
distance
number
dist2d
local vector = math.vec3(1, 0, 0)local vector2 = math.vec3(5, 5, 5)print(vector:dist2d(vector2))
other vector
math.vec3
vector to calculate distance
Returns:
2-dimensional distance
number
to2d
local vector = math.vec3(1, 0, 0)vector:to2d()
Returns:
the original vector with the z component set to 0
math.vec3
cross
local vector1 = math.vec3(1, 0, 0)local vector2 = math.vec3(0, 1, 0)local cross_product = vector1:cross(vector2)
other vector
math.vec3
vector to cross with
Returns:
math.vec3
normalize
local vector1 = math.vec3(50, 50, 100)local vector_normalized = vector1:normalize()
Returns:
math.vec3
dot
local vector1 = math.vec3(50, 50, 100)local dot_product = vector1:dot(math.vec3(1, 33, 7))
other vector
math.vec3
vector to calculate dot product with
Returns:
number
calc_angle
local vector1 = math.vec3(50, 50, 100)local vector2 = math.vec3(1, 33, 7)local angle = vector1:calc_angle(vector2)
other vector
math.vec3
vector to calculate angle with
Returns:
the angle between the two vectors
math.vec3
Last updated