Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

float4x4

struct in Unity.Mathematics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A 4x4 matrix of floats.

Static Properties

Property Description
identityfloat4x4 identity transform.
zerofloat4x4 zero value.

Properties

Property Description
c0Column 0 of the matrix.
c1Column 1 of the matrix.
c2Column 2 of the matrix.
c3Column 3 of the matrix.
this[int]Returns the float4 element at a specified index.

Constructors

Constructor Description
float4x4Constructs a float4x4 matrix from four float4 vectors.

Public Methods

Method Description
EqualsReturns true if the float4x4 is equal to a given float4x4, false otherwise.
GetHashCodeReturns a hash code for the float4x4.
ToStringReturns a string representation of the float4x4.

Static Methods

Method Description
AxisAngle Returns a float4x4 matrix representing a rotation around a unit axis by an angle in radians. The rotation direction is clockwise when looking along the rotation axis towards the origin.
Euler Returns a float4x4 constructed by first performing 3 rotations around the principal axes in a given order. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin. When the rotation order is known at compile time, it is recommended for performance reasons to use specific Euler rotation constructors such as EulerZXY(...).
EulerXYZ Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
EulerXZY Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
EulerYXZ Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
EulerYZX Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
EulerZXY Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin. This is the default order rotation order in Unity.
EulerZYX Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis. All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
LookAt Returns a float4x4 view matrix given an eye position, a target point and a unit length up vector. The up vector is assumed to be unit length, the eye and target points are assumed to be distinct and the vector between them is assumes to be collinear with the up vector. If these assumptions are not met use float4x4.LookRotationSafe instead.
Ortho Returns a float4x4 centered orthographic projection matrix.
OrthoOffCenter Returns a float4x4 off-center orthographic projection matrix.
PerspectiveFov Returns a float4x4 perspective projection matrix based on field of view.
PerspectiveOffCenter Returns a float4x4 off-center perspective projection matrix.
RotateXReturns a float4x4 matrix that rotates around the x-axis by a given number of radians.
RotateYReturns a float4x4 matrix that rotates around the y-axis by a given number of radians.
RotateZReturns a float4x4 matrix that rotates around the z-axis by a given number of radians.
ScaleReturns a float4x4 scale matrix given 3 axis scales.
TranslateReturns a float4x4 translation matrix given a float3 translation vector.
TRS Returns a float4x4 matrix representing a combined scale-, rotation- and translation transform. Equivalent to mul(translationTransform, mul(rotationTransform, scaleTransform)).

Operators

Operator Description
float4x4Implicitly converts a single float value to a float4x4 matrix by assigning it to every component.
float4x4Explicitly converts a single bool value to a float4x4 matrix by converting it to float and assigning it to every component.
float4x4Explicitly converts a bool4x4 matrix to a float4x4 matrix by componentwise conversion.
float4x4Implicitly converts a single int value to a float4x4 matrix by converting it to float and assigning it to every component.
float4x4Implicitly converts a int4x4 matrix to a float4x4 matrix by componentwise conversion.
float4x4Implicitly converts a single uint value to a float4x4 matrix by converting it to float and assigning it to every component.
float4x4Implicitly converts a uint4x4 matrix to a float4x4 matrix by componentwise conversion.
float4x4Explicitly converts a single double value to a float4x4 matrix by converting it to float and assigning it to every component.
float4x4Explicitly converts a double4x4 matrix to a float4x4 matrix by componentwise conversion.
operator -Returns the result of a componentwise subtraction operation on two float4x4 matrices.
operator --Returns the result of a componentwise decrement operation on a float4x4 matrix.
operator !=Returns the result of a componentwise not equal operation on two float4x4 matrices.
operator *Returns the result of a componentwise multiplication operation on two float4x4 matrices.
operator /Returns the result of a componentwise division operation on two float4x4 matrices.
operator %Returns the result of a componentwise modulus operation on two float4x4 matrices.
operator +Returns the result of a componentwise addition operation on two float4x4 matrices.
operator +Returns the result of a componentwise unary plus operation on a float4x4 matrix.
operator ++Returns the result of a componentwise increment operation on a float4x4 matrix.
operator <Returns the result of a componentwise less than operation on two float4x4 matrices.
operator <=Returns the result of a componentwise less or equal operation on two float4x4 matrices.
operator ==Returns the result of a componentwise equality operation on two float4x4 matrices.
operator >Returns the result of a componentwise greater than operation on two float4x4 matrices.
operator >=Returns the result of a componentwise greater or equal operation on two float4x4 matrices.