TRotator

Implements a container for rotation information. All rotation values are stored in degrees.

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/CoreFwd.h

Include

#include "CoreFwd.h"

Syntax

template<typename T>
struct TRotator

Remarks

Implements a container for rotation information.

All rotation values are stored in degrees.

Variables

Name Description

Public variable

T

 

Pitch

Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down)

Public variable

T

 

Roll

Rotation around the forward axis (around X axis), Tilting your head, 0=Straight, +Clockwise, -CCW.

Public variable

T

 

Yaw

Rotation around the up axis (around Z axis), Running in circles 0=East, +North, -South.

Constructors

Name Description

Public function

TRotator()

Default constructor (no initialization).

Public function

TRotator

(
    T InF
)

Constructor

Public function

TRotator

(
    EForceInit
)

Constructor.

Public function

TRotator

(
    const TQuat< T >& Quat
)

Constructor.

Public function

TRotator

(
    const TRotator< FArg >& From
)

Conversion from other type.

Public function

TRotator

(
    T InPitch,
    T InYaw,
    T InRoll
)

Constructor.

Functions

Name Description

Public function

TRotator

 

Add

(
    T DeltaPitch,
    T DeltaYaw,
    T DeltaRoll
)

Adds to each component of the rotator.

Public function Const

TRotator< T ...

 

Clamp()

Gets the rotation values so they fall within the range [0,360]

Public function Static

T

 

ClampAxis

(
    T Angle
)

Clamps an angle to the range of [0, 360).

Public function Static

uint8

 

CompressAxisToByte

(
    T Angle
)

Compresses a floating point angle into a byte.

Public function Static

uint16

 

CompressAxisToShort

(
    T Angle
)

Compress a floating point angle into a word.

Public function Const

bool

 

ContainsNaN()

Utility to check if there are any non-finite values (NaN or Inf) in this Rotator.

Public function Static

T

 

DecompressAxisFromByte

(
    uint8 Angle
)

Decompress a word into a floating point angle.

Public function Static

T

 

DecompressAxisFromShort

(
    uint16 Angle
)

Decompress a short into a floating point angle.

Public function Const

void

 

DiagnosticCheckNaN

(
    const TCHAR* Message
)

Public function Const

void

 

DiagnosticCheckNaN()

Public function Const

bool

 

Equals

(
    const TRotator< T >& R,
    T Tolerance
)

Checks whether two rotators are equal within specified tolerance, when treated as an orientation.

Public function Const

TVector< T >

 

Euler()

Convert a Rotator into floating-point Euler angles (in degrees). Rotator now stored in degrees.

Public function Const

T

 

GetComponentForAxis

(
    EAxis::Type Axis
)

Get a specific component of the vector, given a specific axis by enum

Public function Const

TRotator< T ...

 

GetDenormalized()

Create a copy of this rotator and denormalize, clamping each axis to 0 - 360.

Public function Const

TRotator

 

GetEquivalentRotator()

Return a Rotator that has the same rotation but has different degree values for Yaw, Pitch, and Roll.

Public function Const

TRotator

 

GetInverse()

Returns the inverse of the rotator.

Public function Const

T

 

GetManhattanDistance

(
    const TRotator< T >& Rotator
)

Return the manhattan distance in degrees between this Rotator and the passed in one.

Public function Const

TRotator< T ...

 

GetNormalized()

Create a copy of this rotator and normalize, removes all winding and creates the "shortest route" rotation.

Public function Const

void

 

GetWindingAndRemainder

(
    TRotator< T >& Winding,
    TRotator< T >& Remainder
)

Decompose this Rotator into a Winding part (multiples of 360) and a Remainder part.

Public function Const

TRotator

 

GridSnap

(
    const TRotator< T >& RotGrid
)

Get the rotation, snapped to specified degree segments.

Public function

bool

 

InitFromString

(
    const FString& InSourceString
)

Initialize this Rotator based on an FString.

Public function Const

bool

 

IsNearlyZero

(
    T Tolerance
)

Checks whether rotator is nearly zero within specified tolerance, when treated as an orientation.

Public function Const

bool

 

IsZero()

Checks whether this has exactly zero rotation, when treated as an orientation.

Public function Static

TRotator

 

MakeFromEuler

(
    const TVector< T >& Euler
)

Convert a vector of floating-point Euler angles (in degrees) into a Rotator.

Public function

bool

 

NetSerialize

(
    FArchive& Ar,
    UPackageMap* Map,
    bool& bOutSuccess
)

Public function

void

 

Normalize()

In-place normalize, removes all winding and creates the "shortest route" rotation.

Public function Static

T

 

NormalizeAxis

(
    T Angle
)

Clamps an angle to the range of (-180, 180].

Public function Const

TQuat< T >

 

Quaternion()

Forward declare all explicit specializations (in UnrealMath.cpp)

Public function Const

TVector< T >

 

RotateVector

(
    const UE::Math::TVector< T >& V
)

Rotate a vector rotated by this rotator.

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

void

 

SerializeCompressed

(
    FArchive& Ar
)

Serializes the rotator compressed for e.g. network transmission.

Public function

void

 

SerializeCompressedShort

(
    FArchive& Ar
)

Serializes the rotator compressed for e.g. network transmission (use shorts though).

Public function

bool

 

SerializeFromMismatchedTag

(
    FName StructTag,
    FArchive& Ar
)

Public function Const

void

 

SetClosestToMe

(
    TRotator& MakeClosest
)

Modify if necessary the passed in rotator to be the closest rotator to it based upon it's equivalent.

Public function

void

 

SetComponentForAxis

(
    EAxis::Type Axis,
    T Component
)

Set a specified componet of the vector, given a specific axis by enum

Public function Const

FString

 

ToCompactString()

Get a short textural representation of this vector, for compact readable logging.

Public function Const

FString

 

ToString()

Get a textual representation of the vector.

Public function Const

TVector< T >

 

UnrotateVector

(
    const UE::Math::TVector< T >& V
)

Returns the vector rotated by the inverse of this rotator.

Public function Const

TVector< T >

 

Vector()

Convert a rotation into a unit vector facing in its direction.

Operators

Name Description

Public function Const

TRotator

 

operator-

(
    const TRotator< T >& R
)

Get the result of subtracting a rotator from this.

Public function Const

bool

 

operator!=

(
    const TRotator< T >& V
)

Checks whether two rotators are different.

Public function Const

TRotator

 

operator*

(
    FArg Scale
)

Get the result of scaling this rotator.

Public function

TRotator

 

operator*=

(
    FArg Scale
)

Multiply this rotator by a scaling factor.

Public function Const

TRotator

 

operator+

(
    const TRotator< T >& R
)

Get the result of adding a rotator to this.

Public function

TRotator

 

operator+=

(
    const TRotator< T >& R
)

Adds another rotator to this.

Public function

TRotator

 

operator-=

(
    const TRotator< T >& R
)

Subtracts another rotator from this.

Public function Const

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.