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.
matrix_build(x, y, z, xrotation, yrotation, zrotation, xscale, yscale, zscale);
Argument | Type | Description |
---|---|---|
x | Real | The x component of the translation vector. |
y | Real | The y component of the translation vector. |
z | Real | The z component of the translation vector. |
xrotation | Real | The angle to rotate around the x-axis (in degrees °). |
yrotation | Real | The angle to rotate around the y-axis (in degrees °). |
zrotation | Real | The angle to rotate around the z-axis (in degrees °). |
xscale | Real | The x scale amount. |
yscale | Real | The y scale amount. |
zscale | Real | The z scale amount. |
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".