⚑vector

Variables:

vector(x: number, y: number, z: number)

Name
Type
Description

x

number

-

y

number

-

z

number

-

How to use vector:

--> Vectors
local new_vec = vector(255, 255, 255)
local sec_vec = vector(2000, 100, 100)

--> Length
local new_vec_length = new_vec:length()

--> Distance
local dist = new_vec:dist_to(sec_vec)

Functions:

:length

vec_object:length(): number

Returns the length of the vector.

:length_sqr

vec_object:length_sqr(): number

Returns the squared length of the vector.

:length_2d

vec_object:length_2d(): number

Returns the length of the vector in two dimensions, without the Z axis.

:length_2d_sqr

vec_object:length_2d_sqr(): number

Returns the squared length of the vectors x and y value.

:is_zero

vec_object:is_zero(): boolean

Returns true, if all coordinates of the vector are zero.

:is_valid

vec_object:is_valid(): boolean

Returns true, if the vector is valid.

:zero

vec_object:zero(): vector

Sets zero values to the vector.

:dist_to

vec_object:dist_to(vec_end: vector): number

Name
Type
Description

vec_end

vector

The vector to get the distance to

Returns the distance between the two given vectors.

:dist_to_sqr

vec_object:dist_to_sqr(vec_end: vector): number

Name
Type
Description

vec_end

vector

The vector to get the squared distance to

Returns the squared distance to another vector.

:cross_product

vec_object:cross_product(vec_end: vector): vector

Name
Type
Description

vec_end

vector

The vector to calculate the cross product with

Returns the cross product of two given vectors.

:normalize

vec_object:normalize(): number

Normalizes the vector and returns the length of the vector.

Last updated