Struct RigidTransform
Inherited Members
Namespace: Unity.Mathematics
Syntax
public struct RigidTransform
Constructors
RigidTransform(float3x3, float3)
Constructs a RigidTransform from a rotation represented by a float3x3 matrix and a translation represented by a float3 vector.
Declaration
public RigidTransform(float3x3 rotation, float3 translation)
Parameters
Type | Name | Description |
---|---|---|
float3x3 | rotation | |
float3 | translation |
RigidTransform(float4x4)
Constructs a RigidTransform from a float4x4. Assumes the matrix is orthonormal.
Declaration
public RigidTransform(float4x4 transform)
Parameters
Type | Name | Description |
---|---|---|
float4x4 | transform |
RigidTransform(quaternion, float3)
Constructs a RigidTransform from a rotation represented by a unit quaternion and a translation represented by a float3 vector.
Declaration
public RigidTransform(quaternion rotation, float3 translation)
Parameters
Type | Name | Description |
---|---|---|
quaternion | rotation | |
float3 | translation |
Fields
identity
A RigidTransform representing the identity transform.
Declaration
public static readonly RigidTransform identity
Field Value
Type | Description |
---|---|
RigidTransform |
pos
Declaration
public float3 pos
Field Value
Type | Description |
---|---|
float3 |
rot
Declaration
public quaternion rot
Field Value
Type | Description |
---|---|
quaternion |
Methods
AxisAngle(float3, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform AxisAngle(float3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
float3 | axis | |
System.Single | angle |
Returns
Type | Description |
---|---|
RigidTransform |
Equals(Object)
Returns true if the RigidTransform is equal to a given RigidTransform, false otherwise.
Declaration
public override bool Equals(object x)
Parameters
Type | Name | Description |
---|---|---|
System.Object | x |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Equals(RigidTransform)
Returns true if the RigidTransform is equal to a given RigidTransform, false otherwise.
Declaration
public bool Equals(RigidTransform x)
Parameters
Type | Name | Description |
---|---|---|
RigidTransform | x |
Returns
Type | Description |
---|---|
System.Boolean |
Euler(Single, Single, Single, RotationOrder)
Returns a RigidTransform 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(...).
Declaration
public static RigidTransform Euler(float x, float y, float z, RotationOrder order = null)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
RotationOrder | order | The order in which the rotations are applied. |
Returns
Type | Description |
---|---|
RigidTransform |
Euler(float3, RotationOrder)
Returns a RigidTransform 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(...).
Declaration
public static RigidTransform Euler(float3 xyz, RotationOrder order = null)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
RotationOrder | order | The order in which the rotations are applied. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerXYZ(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerXYZ(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerXYZ(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerXYZ(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerXZY(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerXZY(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerXZY(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerXZY(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerYXZ(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerYXZ(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerYXZ(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerYXZ(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerYZX(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerYZX(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerYZX(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerYZX(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerZXY(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerZXY(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerZXY(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerZXY(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerZYX(Single, Single, Single)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerZYX(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The rotation angle around the x-axis in radians. |
System.Single | y | The rotation angle around the y-axis in radians. |
System.Single | z | The rotation angle around the z-axis in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
EulerZYX(float3)
Returns a RigidTransform 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.
Declaration
public static RigidTransform EulerZYX(float3 xyz)
Parameters
Type | Name | Description |
---|---|---|
float3 | xyz | A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
GetHashCode()
Returns a hash code for the RigidTransform.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
RotateX(Single)
Returns a float4x4 matrix that rotates around the x-axis by a given number of radians.
Declaration
public static RigidTransform RotateX(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The clockwise rotation angle when looking along the x-axis towards the origin in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
RotateY(Single)
Returns a float4x4 matrix that rotates around the y-axis by a given number of radians.
Declaration
public static RigidTransform RotateY(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The clockwise rotation angle when looking along the y-axis towards the origin in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
RotateZ(Single)
Returns a float4x4 matrix that rotates around the z-axis by a given number of radians.
Declaration
public static RigidTransform RotateZ(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The clockwise rotation angle when looking along the z-axis towards the origin in radians. |
Returns
Type | Description |
---|---|
RigidTransform |
ToString()
Returns a string representation of the RigidTransform.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
ToString(String, IFormatProvider)
Returns a string representation of the quaternion using a specified format and culture-specific format information.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | |
System.IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
System.String |
Translate(float3)
Returns a RigidTransform that translates by an amount specified by a float3 vector.
Declaration
public static RigidTransform Translate(float3 vector)
Parameters
Type | Name | Description |
---|---|---|
float3 | vector |
Returns
Type | Description |
---|---|
RigidTransform |