Skip to content

API > Matrix4x4


Matrix4x4⚓︎

standard 4x4 transformation matrix.

Members⚓︎

Properties⚓︎

Name Description
Matrix4x4.[index]Property Access element at sequential index (1..16 inclusive).
Matrix4x4.[row, column]Property Access element at [row, column].
Matrix4x4.decomposeProjectionProperty This property takes a projection matrix and returns the six plane coordinates that define a projection frustum.
Matrix4x4.determinantPropertyReadonly Property The determinant of the matrix. (Read Only)
Matrix4x4.inversePropertyReadonly Property The inverse of this matrix. (Read Only)
Matrix4x4.isIdentityPropertyReadonly Property Checks whether this is an identity matrix. (Read Only)
Matrix4x4.lossyScalePropertyReadonly Property Attempts to get a scale value from the matrix. (Read Only)
Matrix4x4.rotationProperty Attempts to get a rotation quaternion from this matrix.
Matrix4x4.transposePropertyReadonly Property Returns the transpose of this matrix (Read Only).

Static Properties⚓︎

Name Description
Matrix4x4.identity Static fieldPropertyReadonly Property Returns the identity matrix (Read Only).
Matrix4x4.zero Static fieldPropertyReadonly Property Returns a matrix with all elements set to zero (Read Only).

Methods⚓︎

Name Description
Matrix4x4.GetColumn(index) Method Get a column of the matrix.
The i-th column is returned as a Vector4. i must be from 1 to 4 inclusive.
Matrix4x4.GetRow(index) Method Returns a row of the matrix.
Matrix4x4.MultiplyPoint(point) Method Transforms a position by this matrix (generic).
Matrix4x4.MultiplyPoint3x4( point) Method Transforms a position by this matrix (fast).
Matrix4x4.MultiplyVector(vector) Method Transforms a direction by this matrix.
Matrix4x4.SetColumn(index, column) Method Sets a column of the matrix.
Matrix4x4.SetRow(index, row) Method Sets a row of the matrix.
Matrix4x4.TransformPlane(plane) Method Returns a plane that is transformed in space.
Matrix4x4.ValidTRS() Method Checks if this matrix is a valid transform matrix.

Static Methods⚓︎

Name Description
Matrix4x4.Frustum(left, right, bottom, top, zNear, zFar) Static fieldMethod This function returns a projection matrix with viewing frustum that has a near plane defined by the coordinates that were passed in.
Matrix4x4.Frustum(frustumPlanes) Static fieldMethod This function returns a projection matrix with viewing frustum that has a near plane defined by the coordinates that were passed in.
Matrix4x4.Inverse3DAffine(input) Static fieldMethod Computes the inverse of a 3D affine matrix.
Matrix4x4.LookAt(from, to, up) Static fieldMethod Create a "look at" matrix.
Matrix4x4.Ortho(left, right, bottom, top, zNear, zFar) Static fieldMethod Create an orthogonal projection matrix.
Matrix4x4.Perspective(fov, aspect, zNear, zFar) Static fieldMethod Create a perspective projection matrix.
Matrix4x4.Rotate(q) Static fieldMethod Creates a rotation matrix.
Matrix4x4.Scale(vector) Static fieldMethod Creates a scaling matrix.
Matrix4x4.Translate(vector) Static fieldMethod Creates a translation matrix.
Matrix4x4.TRS(pos, q, s) Static fieldMethod Creates a translation, rotation and scaling matrix.

Operators⚓︎

Name Description
Operator (Matrix4x4*Matrix4x4)Operator Multiplies two matrices.

| Operator (Matrix4x4*Vector4)Operator | Transforms a Vector4 by a matrix. |

Extra Detail⚓︎

A transformation matrix can perform arbitrary linear 3D transformations (i.e. translation, rotation, scale, shear etc.) and perspective transformations using homogenous coordinates. You rarely use matrices in scripts; most often using Vector3s, Quaternions and functionality of Transform class is more straightforward. Plain matrices are used in special cases like setting up nonstandard camera projection.