Create a 4x4 matrix with the given arguments in row-major order. If no arguments are provided, the constructor initializes the Matrix4 to the 4x4 identity matrix.
Optional
n11: numberInput element in the first row and the first column
Optional
n12: numberInput element in the first row and the second column
Optional
n13: numberInput element in the first row and the third column
Optional
n14: numberInput element in the first row and the forth column
Optional
n21: numberInput element in the second row and the first column
Optional
n22: numberInput element in the second row and the second column
Optional
n23: numberInput element in the second row and the third column
Optional
n24: numberInput element in the second row and the forth column
Optional
n31: numberInput element in the third row and the first column
Optional
n32: numberInput element in the third row and the second column
Optional
n33: numberInput element in the third row and the third column
Optional
n34: numberInput element in the third row and the forth column
Optional
n41: numberInput element in the forth row and the first column
Optional
n42: numberInput element in the forth row and the second column
Optional
n43: numberInput element in the forth row and the third column
Optional
n44: numberInput element in the forth row and the forth column
A column-major list of matrix values.
Static
IDENTITYIdentity matrix.
Set this matrix to the transformation composed of position, quaternion and scale.
Input position
Input quaternion
Input scale
Return this matrix
Copy the elements of matrix m into this matrix.
Input one matrix copied from
Return this matrix
Copy the translation component of the supplied matrix m into this matrix's translation component.
Input the matrix copied from
Return this matrix
Decompose this matrix into its position, quaternion and scale components.
Note: Not all matrices are decomposable in this way. For example, if an object has a non-uniformly scaled parent, then the object's world matrix may not be decomposable, and this method may not be appropriate.
Input position to output
Input quaternion to output
Input scale to output
Return this matrix
Return true if this matrix and m are equal.
Input one matrix to compare
Return true if this matrix and m are equal.
Extracts the basis of this matrix into the three axis vectors provided.
Input X axis vector
Input Y axis vector
Input Z axis vector
Return this matrix
Extracts the rotation component of the supplied matrix m into this matrix's rotation component.
Input one 4x4 matrix
Return this matrix
Set the elements of this matrix based on an array in column-major format.
Input the array to read the elements from.
Input (optional) offset into the array. Default is 0.
Reset this matrix to the identity matrix.
Return this matrix
Invert this matrix, using the analytic method. You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead.
Return this matrix
Construct a rotation matrix, looking from eye towards target oriented by the up vector.
Input eye vector
Input target vector
Input up vector
Return this matrix
Set this to the basis matrix consisting of the three provided basis vectors:
Input X axis vector
Input Y axis vector
Input Z axis vector
Return this matrix
Set this matrix as rotation transform around axis by theta radians.
Input rotation axis, should be normalized.
Input rotation angle in radians.
Return this matrix
Set the rotation component of this matrix to the rotation specified by q
Input one uaternion
Return this matrix
Set this matrix as a rotational transformation around the X axis by theta (θ) radians.
Input rotation angle in radians.
Return this matrix
Set this matrix as a rotational transformation around the Y axis by theta (θ) radians.
Input rotation angle in radians.
Return this matrix
Set this matrix as a rotational transformation around the Z axis by theta (θ) radians.
Input rotation angle in radians.
Return this matrix
Set this matrix as scale transform.
Input x scale
Input y scale
Input z scale
Return this matrix
Set this matrix as a shear transform.
Input the amount to shear X by Y.
Input the amount to shear X by Z.
Input the amount to shear Y by X.
Input the amount to shear Y by Z.
Input the amount to shear Z by X.
Input the amount to shear Z by Y.
Return this matrix
Set this matrix as a translation transform from vector v, or numbers x, y and z.
Input one vector or one number
Optional
y: numberInput one number
Optional
z: numberInput one number
Return this matrix
Post-multiply this matrix by m.
Input one 4x4 matrix
Return this matrix
Set this matrix to a x b.
Input one 4x4 matrix
Input one 4x4 matrix
Return this matrix
Multiply every component of the matrix by a scalar value s.
Input one scalar value
Return this matrix
Pre-multiply this matrix by m.
Input one 4x4 matrix
Return this matrix
Multiply the columns of this matrix by vector v.
Input one vector
Return this matrix
Set the elements of this matrix to the supplied row-major values n11, n12, ... n44.
Input element in the first row and the first column
Input element in the first row and the second column
Input element in the first row and the third column
Input element in the first row and the forth column
Input element in the second row and the first column
Input element in the second row and the second column
Input element in the second row and the third column
Input element in the second row and the forth column
Input element in the third row and the first column
Input element in the third row and the second column
Input element in the third row and the third column
Input element in the third row and the forth column
Input element in the forth row and the first column
Input element in the forth row and the second column
Input element in the forth row and the third column
Input element in the forth row and the forth column
Return this matrix
Create transform matrix according to the given the normalized extrusion vector
Input the normalized extrusion vector
Return this matrix
Set the upper 3x3 elements of this matrix to the values of the 3x3 matrix m.
Input one 3x3 matrix
Return this matrix
Set the position component for this matrix from vector v, without affecting the rest of the matrix.
Input one number or one vector
Input one number
Input one number
Return this matrix
Write the elements of this matrix to an array in column-major format.
Input (optional) array to store the resulting vector in.
Input (optional) offset in the array at which to put the result.
Return an array in column-major format by writing the elements of this matrix to it
Transposes this matrix.
Return this matrix
The class representing a 4x4 matrix.