matrix_build

This function can be used to create your own custom matrix and will return a matrix array, which should be stored in a variable for future reference and use. It accepts 3-dimensional (x, y, z) translation, rotation and scale values, and uses them to build a matrix array.

The matrix array contains 16 values in total, where the initial 4 elements are row/column 1, the next 4 elements are row/column 2 and so on, as part of a 4x4 matrix. Whether the array is ordered by rows or columns depends on the target platform, as the graphics renderer used by a platform may use row-major or column-major matrices.

NOTE When you build a new matrix in this way, the order of operation is YXZ.

 

Syntax:

matrix_build(x, y, z, xrotation, yrotation, zrotation, xscale, yscale, zscale);

ArgumentType Description
xReal The x component of the translation vector.
yReal The y component of the translation vector.
zReal The z component of the translation vector.
xrotationReal The angle to rotate around the x-axis (in degrees °).
yrotationReal The angle to rotate around the y-axis (in degrees °).
zrotationReal The angle to rotate around the z-axis (in degrees °).
xscaleReal The x scale amount.
yscaleReal The y scale amount.
zscaleReal The z scale amount.

 

Returns:

Matrix Array

 

Example:

t_matrix = matrix_build(x, y, 0, 0, 90, 0, 1, 2, 1);

The above code will build a new matrix transform and store the resulting matrix index in the variable "t_matrix".