Skip to content

Vector3

Adrien GIVRY edited this page Sep 26, 2020 · 3 revisions

Description

Mathematic representation of a 3D vector of floats

Variables

Name Type Description
x number X component of the Vector3
y number Y component of the Vector3
z number Z component of the Vector3

Constructors

Name Input Output Description
new Vector3 Create an instance of Vector3 with x, y and z equals to zero
new number: x
number: y
number: z
Vector3 Create an instance of Vector3 with the given values

Functions

Name Input Output Description
One Vector3 Returns a (1,1,1) Vector3
Zero Vector3 Returns a (0,0,0) Vector3
Forward Vector3 Returns a (0,0,1) Vector3
Up Vector3 Returns a (0,1,0) Vector3
Right Vector3 Returns a (1,0,0) Vector3
Backward Vector3 Returns a (0,0,-1) Vector3
Down Vector3 Returns a (0,-1,0) Vector3
Left Vector3 Returns a (-1,0,0) Vector3
Length Vector3: instance
number Returns the length of the given Vector3
Dot Vector3: a
Vector3: b
number Returns the dot product of the two given Vector3
Cross Vector3: a
Vector3: b
Vector3 Returns the cross product of the two given Vector3
Normalize Vector3: instance
Vector3 Returns the normalized version of the given Vector3
Lerp Vector3: a
Vector3: instance
number: t
Vector3 Calculates the linear interpolation between two Vector3 using the given alpha
AngleBetween Vector3: a
Vector3: b
number Calculates the angle between two Vector3
Distance Vector3: a
b: instance
number Returns the distance between the given Vector3

Operators

Operation Description
Vector3 + Vector3 Adds two Vector3
Vector3 - Vector3 Substracts two Vector3
-Vector3 Multiplies each components of a Vector3 by -1
Vector3 * number Multiplies each component of a Vector3 by a number
Vector3 / Vector3 Divides each component of a Vector3 by a number
to_string(Vector3) Converts a Vector3 to a string
Clone this wiki locally