Dev - Data Types - Vector

Vectors are sets of N float-values. Most commonly used to represent positions and scales. There's Vector2, Vector3 and Vector4 which are only different in the number of values N (2, 3 and 4).

Vector Parameters

When methods have vector parameters you can specify them in two different ways:

Vector Return Values

When a method returns a vector, it will be a tuple of N numbers.

1
x, y, z = entity.getScale(1)

Vector2

A vector with 2 values (N=2). Often used for 2D positions or scales. Sample declaration:

1
myVector2 = {5.1, 2.9}

Vector3

A vector with 3 values (N=3). Often used for positions, scales or rotations (Euler angles) in 3D. Sample declaration:

1
myVector3 = {5.1, 2.9, 8.7}

Vector4

A vector with 4 values (N=4). Sample declaration:

1
myVector4 = {5.1, 2.9, 8.7, 3.4}