FRotator

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

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/Rotator.h

Include

#include "Math/Rotator.h"

Syntax

struct FRotator

Remarks

Implements a container for rotation information.

All rotation values are stored in degrees.

Variables

Name Description

Public variable

float

 

Pitch

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

Public variable

float

 

Roll

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

Public variable

float

 

Yaw

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

Constructors

Name Description

Public function

FRotator()

Default constructor (no initialization).

Public function

FRotator

(
    float InF
)

Constructor

Public function

FRotator

(
    EForceInit
)

Constructor.

Public function

FRotator

(
    const FQuat& Quat
)

Constructor.

Public function

FRotator

(
    float InPitch,
    float InYaw,
    float InRoll
)

Constructor.

Functions

Name Description

Public function

FRotator

 

Add

(
    float DeltaPitch,
    float DeltaYaw,
    float DeltaRoll
)

Adds to each component of the rotator.

Public function Const

FRotator

 

Clamp()

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

Public function Static

float

 

ClampAxis

(
    float Angle
)

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

Public function Static

uint8

 

CompressAxisToByte

(
    float Angle
)

Compresses a floating point angle into a byte.

Public function Static

uint16

 

CompressAxisToShort

(
    float 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

float

 

DecompressAxisFromByte

(
    uint8 Angle
)

Decompress a word into a floating point angle.

Public function Static

float

 

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 FRotator& R,
    float Tolerance
)

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

Public function Const

FVector

 

Euler()

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

Public function Const

float

 

GetComponentForAxis

(
    EAxis::Type Axis
)

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

Public function Const

FRotator

 

GetDenormalized()

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

Public function Const

FRotator

 

GetEquivalentRotator()

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

Public function Const

FRotator

 

GetInverse()

Returns the inverse of the rotator.

Public function Const

float

 

GetManhattanDistance

(
    const FRotator& Rotator
)

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

Public function Const

FRotator

 

GetNormalized()

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

Public function Const

void

 

GetWindingAndRemainder

(
    FRotator& Winding,
    FRotator& Remainder
)

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

Public function Const

FRotator

 

GridSnap

(
    const FRotator& 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

(
    float 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

FRotator

 

MakeFromEuler

(
    const FVector& 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

float

 

NormalizeAxis

(
    float Angle
)

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

Public function Const

FQuat

 

Quaternion()

Get Rotation as a quaternion.

Public function Const

FVector

 

RotateVector

(
    const FVector& 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 Const

void

 

SetClosestToMe

(
    FRotator& 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,
    float 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

FVector

 

UnrotateVector

(
    const FVector& V
)

Returns the vector rotated by the inverse of this rotator.

Public function Const

FVector

 

Vector()

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

Operators

Name Description

Public function Const

FRotator

 

operator-

(
    const FRotator& R
)

Get the result of subtracting a rotator from this.

Public function Const

bool

 

operator!=

(
    const FRotator& V
)

Checks whether two rotators are different.

Public function Const

FRotator

 

operator*

(
    float Scale
)

Get the result of scaling this rotator.

Public function

FRotator

 

operator*=

(
    float Scale
)

Multiply this rotator by a scaling factor.

Public function Const

FRotator

 

operator+

(
    const FRotator& R
)

Get the result of adding a rotator to this.

Public function

FRotator

 

operator+=

(
    const FRotator& R
)

Adds another rotator to this.

Public function

FRotator

 

operator-=

(
    const FRotator& R
)

Subtracts another rotator from this.

Public function Const

bool

 

operator==

(
    const FRotator& R
)

Checks whether two rotators are identical. This checks each component for exact equality.

Constants

Name

Description

ZeroRotator

A rotator of zero degrees on each axis.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss