Multiply two matrix arrays together.


matrix_multiply(matrix1, matrix2)

Argument Description
matrix1 The first matrix (as an array) to use.
matrix2 The second matrix (as an array) to use.

Returns: Array


With this function you can multiply two matrix arrays together to create a new transform matrix. The function will return the new matrix (again, as an array) which should be stored in a variable for future use.

NOTE: You can't use a matrix constant as an argument with this function, so if you wish to multiply the (for example) view matrix with a custom matrix that you have built, you must first call matrix_get(type) and assign the view matrix values to an array variable, then multiply it by your custom matrix, and then set the chosen matrix (view, projection or world).


var v_matrix = matrix_get(matrix_view);
var new_matrix = matrix_multiply(v_matrix, my_matrix);
matrix_set(matrix_view, new_matrix);

The above code will get the current view matrix, then multiply that with a custom matrix and then use the resulting matrix array to set the view matrix again.

Back: 3D Transformations
Next: d3d_transform_set_identity
© Copyright YoYo Games Ltd. 2018 All Rights Reserved