API > Matrix4x4
Matrix4x4⚓︎
standard 4x4 transformation matrix.
Members⚓︎
Properties⚓︎
Name | Description |
---|---|
Matrix4x4 .[index] |
Access element at sequential index (1..16 inclusive). |
Matrix4x4 .[row, column] |
Access element at [row, column]. |
Matrix4x4 .decomposeProjection |
This property takes a projection matrix and returns the six plane coordinates that define a projection frustum. |
Matrix4x4 .determinant |
The determinant of the matrix. (Read Only) |
Matrix4x4 .inverse |
The inverse of this matrix. (Read Only) |
Matrix4x4 .isIdentity |
Checks whether this is an identity matrix. (Read Only) |
Matrix4x4 .lossyScale |
Attempts to get a scale value from the matrix. (Read Only) |
Matrix4x4 .rotation |
Attempts to get a rotation quaternion from this matrix. |
Matrix4x4 .transpose |
Returns the transpose of this matrix (Read Only). |
Static Properties⚓︎
Name | Description |
---|---|
Matrix4x4 .identity |
Returns the identity matrix (Read Only). |
Matrix4x4 .zero |
Returns a matrix with all elements set to zero (Read Only). |
Methods⚓︎
Name | Description |
---|---|
Matrix4x4 .GetColumn(index) |
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) |
Returns a row of the matrix. |
Matrix4x4 .MultiplyPoint(point) |
Transforms a position by this matrix (generic). |
Matrix4x4 .MultiplyPoint3x4( point) |
Transforms a position by this matrix (fast). |
Matrix4x4 .MultiplyVector(vector) |
Transforms a direction by this matrix. |
Matrix4x4 .SetColumn(index, column) |
Sets a column of the matrix. |
Matrix4x4 .SetRow(index, row) |
Sets a row of the matrix. |
Matrix4x4 .TransformPlane(plane) |
Returns a plane that is transformed in space. |
Matrix4x4 .ValidTRS() |
Checks if this matrix is a valid transform matrix. |
Static Methods⚓︎
Name | Description |
---|---|
Matrix4x4 .Frustum(left, right, bottom, top, zNear, zFar) |
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) |
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) |
Computes the inverse of a 3D affine matrix. |
Matrix4x4 .LookAt(from, to, up) |
Create a "look at" matrix. |
Matrix4x4 .Ortho(left, right, bottom, top, zNear, zFar) |
Create an orthogonal projection matrix. |
Matrix4x4 .Perspective(fov, aspect, zNear, zFar) |
Create a perspective projection matrix. |
Matrix4x4 .Rotate(q) |
Creates a rotation matrix. |
Matrix4x4 .Scale(vector) |
Creates a scaling matrix. |
Matrix4x4 .Translate(vector) |
Creates a translation matrix. |
Matrix4x4 .TRS(pos, q, s) |
Creates a translation, rotation and scaling matrix. |
Operators⚓︎
Name | Description |
---|---|
Operator (Matrix4x4*Matrix4x4) | Multiplies two matrices. |
| Operator (Matrix4x4*Vector4) | 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.