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);

ArgumentTypeDescription
xRealThe x component of the translation vector.
yRealThe y component of the translation vector.
zRealThe z component of the translation vector.
xrotationRealThe angle to rotate around the x-axis (in degrees °).
yrotationRealThe angle to rotate around the y-axis (in degrees °).
zrotationRealThe angle to rotate around the z-axis (in degrees °).
xscaleRealThe x scale amount.
yscaleRealThe y scale amount.
zscaleRealThe 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".