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