Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Math
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Math/MathFwd.h |
| Include | #include "Math/MathFwd.h" |
Syntax
template<typename T>
struct TRotator
Remarks
Implements a container for rotation information.
All rotation values are stored in degrees.
The angles are interpreted as intrinsic rotations applied in the order Yaw, then Pitch, then Roll. I.e., an object would be rotated first by the specified yaw around its up axis (with positive angles interpreted as clockwise when viewed from above, along -Z), then pitched around its (new) right axis (with positive angles interpreted as 'nose up', i.e. clockwise when viewed along +Y), and then finally rolled around its (final) forward axis (with positive angles interpreted as clockwise rotations when viewed along +X).
Note that these conventions differ from quaternion axis/angle. UE Quat always considers a positive angle to be a left-handed rotation, whereas Rotator treats yaw as left-handed but pitch and roll as right-handed.
Variables
| Type | Name | Description | |
|---|---|---|---|
| T | Pitch | Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down) | |
| T | Roll | Rotation around the forward axis (around X axis), Tilting your head, (0=Straight, +Clockwise, -CCW) | |
| T | Yaw | Rotation around the up axis (around Z axis), Turning around (0=Forward, +Right, -Left) |
Constructors
| Type | Name | Description | |
|---|---|---|---|
TRotator () |
Default constructor (no initialization). | ||
TRotator
(
T InF |
Constructor | ||
TRotator
(
EForceInit |
Constructor. | ||
| Constructor. | |||
| Conversion from other type. | |||
TRotator
(
T InPitch, |
Constructor. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| TRotator | Add
(
T DeltaPitch, |
Adds to each component of the rotator. | |
| TRotator< T > | Clamp () |
Gets the rotation values so they fall within the range [0,360] | |
| T | ClampAxis
(
T Angle |
Clamps an angle to the range of [0, 360). | |
| uint8 | CompressAxisToByte
(
T Angle |
Compresses a floating point angle into a byte. | |
| uint16 | CompressAxisToShort
(
T Angle |
Compress a floating point angle into a word. | |
| bool | ContainsNaN () |
Utility to check if there are any non-finite values (NaN or Inf) in this Rotator. | |
| T | DecompressAxisFromByte
(
uint8 Angle |
Decompress a word into a floating point angle. | |
| T | DecompressAxisFromShort
(
uint16 Angle |
Decompress a short into a floating point angle. | |
| void | DiagnosticCheckNaN
(
const TCHAR* Message |
||
| void | |||
| bool | Checks whether two rotators are equal within specified tolerance, when treated as an orientation. | ||
| TVector< T > | Euler () |
Convert a Rotator into floating-point Euler angles (in degrees). Rotator now stored in degrees. | |
| T | GetComponentForAxis
(
EAxis::Type Axis |
Get a specific component of the vector, given a specific axis by enum | |
| TRotator< T > | Create a copy of this rotator and denormalize, clamping each axis to 0 - 360. | ||
| TRotator | Return a Rotator that has the same rotation but has different degree values for Yaw, Pitch, and Roll. | ||
| TRotator | GetInverse () |
Returns the inverse of the rotator. | |
| T | GetManhattanDistance
(
const TRotator< T >& Rotator |
Return the manhattan distance in degrees between this Rotator and the passed in one. | |
| TRotator< T > | Create a copy of this rotator and normalize, removes all winding and creates the "shortest route" rotation. | ||
| void | GetWindingAndRemainder
(
TRotator< T >& Winding, |
Decompose this Rotator into a Winding part (multiples of 360) and a Remainder part. | |
| TRotator | Get the rotation, snapped to specified degree segments. | ||
| bool | InitFromString
(
const FString& InSourceString |
Initialize this Rotator based on an FString. | |
| bool | IsNearlyZero
(
T Tolerance |
Checks whether rotator is nearly zero within specified tolerance, when treated as an orientation. | |
| bool | IsZero () |
Checks whether this has exactly zero rotation, when treated as an orientation. | |
| TRotator | MakeFromEuler
(
const TVector< T >& Euler |
Convert a vector of floating-point Euler angles (in degrees) into a Rotator. | |
| bool | NetSerialize
(
FArchive& Ar, |
||
| void | Normalize () |
In-place normalize, removes all winding and creates the "shortest route" rotation. | |
| T | NormalizeAxis
(
T Angle |
Clamps an angle to the range of (-180, 180]. | |
| TQuat< T > | Quaternion () |
Get Rotation as a quaternion. | |
| TVector< T > | RotateVector
(
const UE::Math::TVector< T >& V |
Rotate a vector rotated by this rotator. | |
| bool | |||
| void | SerializeCompressed
(
FArchive& Ar |
Serializes the rotator compressed for e.g. network transmission. | |
| void | SerializeCompressedShort
(
FArchive& Ar |
Serializes the rotator compressed for e.g. network transmission (use shorts though). | |
| bool | SerializeFromMismatchedTag
(
FName StructTag, |
||
| void | SetClosestToMe
(
TRotator& MakeClosest |
Modify if necessary the passed in rotator to be the closest rotator to it based upon it's equivalent. | |
| void | SetComponentForAxis
(
EAxis::Type Axis, |
Set a specified componet of the vector, given a specific axis by enum | |
| FString | Get a short textural representation of this vector, for compact readable logging. | ||
| FString | ToString () |
Get a textual representation of the vector. | |
| TVector< T > | UnrotateVector
(
const UE::Math::TVector< T >& V |
Returns the vector rotated by the inverse of this rotator. | |
| TVector< T > | Vector () |
Convert a rotation into a unit vector facing in its direction. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| TRotator | Get the result of subtracting a rotator from this. | ||
| bool | operator!=
(
const TRotator< T >& V |
Checks whether two rotators are different. | |
| TRotator | operator*
(
FArg Scale |
Get the result of scaling this rotator. | |
| TRotator | operator*=
(
FArg Scale |
Multiply this rotator by a scaling factor. | |
| TRotator | Get the result of adding a rotator to this. | ||
| TRotator | operator+=
(
const TRotator< T >& R |
Adds another rotator to this. | |
| TRotator | operator-=
(
const TRotator< T >& R |
Subtracts another rotator from this. | |
| bool | operator==
(
const TRotator< T >& R |
Checks whether two rotators are identical. This checks each component for exact equality. |
Typedefs
| Name | Description |
|---|---|
| FReal | Can't have a TEMPLATE_REQUIRES in the declaration because of the forward declarations, so check for allowed types here. |
Constants
| Name | Description |
|---|---|
| ZeroRotator | A rotator of zero degrees on each axis. |