![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Rotator.h>
Public Types | |
| using | FReal = T |
Static Public Member Functions | |
| static T | ClampAxis (T Angle) |
| static T | NormalizeAxis (T Angle) |
| static uint8 | CompressAxisToByte (T Angle) |
| static T | DecompressAxisFromByte (uint8 Angle) |
| static uint16 | CompressAxisToShort (T Angle) |
| static T | DecompressAxisFromShort (uint16 Angle) |
| static CORE_API TRotator | MakeFromEuler (const TVector< T > &Euler) |
Public Attributes | |
| T | Pitch |
| T | Yaw |
| T | Roll |
Static Public Attributes | |
| static CORE_API const TRotator< T > | ZeroRotator |
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.
| using UE::Math::TRotator< T >::FReal = T |
|
default |
Default constructor (no initialization).
|
inlineexplicit |
Constructor
| InF | Value to set all components to. |
|
inline |
Constructor.
| InPitch | Pitch in degrees. |
| InYaw | Yaw in degrees. |
| InRoll | Roll in degrees. |
|
explicit |
Constructor.
| EForceInit | Force Init Enum. |
|
explicit |
Constructor.
| Quat | Quaternion used to specify rotation. |
|
inlineexplicit |
|
inline |
Adds to each component of the rotator.
| DeltaPitch | Change in pitch. (+/-) |
| DeltaYaw | Change in yaw. (+/-) |
| DeltaRoll | Change in roll. (+/-) |
| UE_FORCEINLINE_HINT TRotator< T > UE::Math::TRotator< T >::Clamp | ( | ) | const |
Gets the rotation values so they fall within the range [0,360]
|
inlinestatic |
Clamps an angle to the range of [0, 360).
| Angle | The angle to clamp. |
|
static |
Compresses a floating point angle into a byte.
| Angle | The angle to compress. |
|
static |
Compress a floating point angle into a word.
| Angle | The angle to compress. |
|
inline |
Utility to check if there are any non-finite values (NaN or Inf) in this Rotator.
|
static |
Decompress a word into a floating point angle.
| Angle | The word angle. |
|
static |
Decompress a short into a floating point angle.
| Angle | The word angle. |
|
inline |
|
inline |
|
inline |
Checks whether two rotators are equal within specified tolerance, when treated as an orientation. This means that TRotator(0, 0, 360).Equals(TRotator(0,0,0)) is true, because they represent the same final orientation. It can compare only wound rotators (i.e. multiples of 360 degrees) that end up in a same rotation Rotators that represent the same final rotation, but get there via different intermediate rotations aren't equal i.e. TRotator(0, 45, 0).Equals(TRotator(180, 135, 180)) is false
| R | The other rotator. |
| Tolerance | Error Tolerance. |
| bool UE::Math::TRotator< T >::EqualsOrientation | ( | const TRotator< T > & | R, |
| T | Tolerance = UE_KINDA_SMALL_NUMBER |
||
| ) | const |
Checks whether two rotators have the same orientation within the specified tolerance, without requiring similar angles or wound multiples of 360. Unlike Equals(), it can compare Rotators that represent the same final orientation, but get there via different intermediate rotations. i.e. If we compare two rotators with different angles, but same orientation like so: A = TRotator(0, 45, 0) B = TRotator(180, 135, 180) Then A.EqualsOrientation(B) would be TRUE while A.Equals(B) would be FALSE
| R | The other rotator. |
| Tolerance | Error Tolerance. |
| UE::Math::TVector< T > UE::Math::TRotator< T >::Euler | ( | ) | const |
Convert a Rotator into floating-point Euler angles (in degrees). Rotator now stored in degrees.
|
inline |
Get a specific component of the vector, given a specific axis by enum
|
inline |
Create a copy of this rotator and denormalize, clamping each axis to 0 - 360.
| UE_FORCEINLINE_HINT TRotator< T > UE::Math::TRotator< T >::GetEquivalentRotator | ( | ) | const |
Return a Rotator that has the same rotation but has different degree values for Yaw, Pitch, and Roll. This rotator should be within -180,180 range,
| UE::Math::TRotator< T > UE::Math::TRotator< T >::GetInverse | ( | ) | const |
Returns the inverse of the rotator.
| UE_FORCEINLINE_HINT T UE::Math::TRotator< T >::GetManhattanDistance | ( | const TRotator< T > & | Rotator | ) | const |
Return the manhattan distance in degrees between this Rotator and the passed in one.
| Rotator[In] | the Rotator we are comparing with. |
|
inline |
Create a copy of this rotator and normalize, removes all winding and creates the "shortest route" rotation.
| void UE::Math::TRotator< T >::GetWindingAndRemainder | ( | TRotator< T > & | Winding, |
| TRotator< T > & | Remainder | ||
| ) | const |
Decompose this Rotator into a Winding part (multiples of 360) and a Remainder part. Remainder will always be in [-180, 180] range.
| Winding[Out] | the Winding part of this Rotator |
| Remainder[Out] | the Remainder |
|
inline |
Get the rotation, snapped to specified degree segments.
| RotGrid | A Rotator specifying how to snap each component. |
|
inline |
|
inline |
Checks whether rotator is nearly zero within specified tolerance, when treated as an orientation. This means that TRotator(0, 0, 360) is "zero", because it is the same final orientation as the zero rotator.
| Tolerance | Error Tolerance. |
| UE_FORCEINLINE_HINT bool UE::Math::TRotator< T >::IsZero | ( | ) | const |
Checks whether this has exactly zero rotation, when treated as an orientation. This means that TRotator(0, 0, 360) is "zero", because it is the same final orientation as the zero rotator.
|
static |
Convert a vector of floating-point Euler angles (in degrees) into a Rotator. Rotator now stored in degrees
| Euler | Euler angle vector. |
| bool UE::Math::TRotator< T >::NetSerialize | ( | FArchive & | Ar, |
| class UPackageMap * | Map, | ||
| bool & | bOutSuccess | ||
| ) |
|
inline |
In-place normalize, removes all winding and creates the "shortest route" rotation.
|
inlinestatic |
Clamps an angle to the range of (-180, 180].
| Angle | The Angle to clamp. |
| UE_FORCEINLINE_HINT bool UE::Math::TRotator< T >::operator!= | ( | const TRotator< T > & | V | ) | const |
Checks whether two rotators are different.
| V | The other rotator. |
|
inline |
Get the result of scaling this rotator.
| Scale | The scaling factor. |
|
inline |
Multiply this rotator by a scaling factor.
| Scale | The scaling factor. |
| UE_FORCEINLINE_HINT TRotator< T > UE::Math::TRotator< T >::operator+ | ( | const TRotator< T > & | R | ) | const |
Get the result of adding a rotator to this.
| R | The other rotator. |
|
inline |
Adds another rotator to this.
| R | The other rotator. |
| UE_FORCEINLINE_HINT TRotator< T > UE::Math::TRotator< T >::operator- | ( | const TRotator< T > & | R | ) | const |
Get the result of subtracting a rotator from this.
| R | The other rotator. |
|
inline |
Subtracts another rotator from this.
| R | The other rotator. |
| UE_FORCEINLINE_HINT bool UE::Math::TRotator< T >::operator== | ( | const TRotator< T > & | R | ) | const |
Checks whether two rotators are identical. This checks each component for exact equality.
| R | The other rotator. |
| CORE_API TQuat< T > UE::Math::TRotator< T >::Quaternion | ( | ) | const |
Get Rotation as a quaternion.
| UE::Math::TVector< T > UE::Math::TRotator< T >::RotateVector | ( | const UE::Math::TVector< T > & | V | ) | const |
Rotate a vector rotated by this rotator.
| V | The vector to rotate. |
|
inline |
| void UE::Math::TRotator< T >::SerializeCompressed | ( | FArchive & | Ar | ) |
Serializes the rotator compressed for e.g. network transmission.
| Ar | Archive to serialize to/ from |
| void UE::Math::TRotator< T >::SerializeCompressedShort | ( | FArchive & | Ar | ) |
Serializes the rotator compressed for e.g. network transmission (use shorts though).
| Ar | Archive to serialize to/ from |
|
inline |
|
inline |
Modify if necessary the passed in rotator to be the closest rotator to it based upon it's equivalent. This Rotator should be within (-180, 180], usually just constructed from a Matrix or a Quaternion.
| MakeClosest[In/Out] | the Rotator we want to make closest to us. Should be between (-180, 180]. This Rotator may change if we need to use different degree values to make it closer. |
|
inline |
Set a specified componet of the vector, given a specific axis by enum
|
inline |
Get a short textural representation of this vector, for compact readable logging.
| UE_FORCEINLINE_HINT FString UE::Math::TRotator< T >::ToString | ( | ) | const |
Get a textual representation of the vector.
| UE::Math::TVector< T > UE::Math::TRotator< T >::UnrotateVector | ( | const UE::Math::TVector< T > & | V | ) | const |
Returns the vector rotated by the inverse of this rotator.
| V | The vector to rotate. |
| UE::Math::TVector< T > UE::Math::TRotator< T >::Vector | ( | ) | const |
Convert a rotation into a unit vector facing in its direction.
| T UE::Math::TRotator< T >::Pitch |
Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down)
| T UE::Math::TRotator< T >::Roll |
Rotation around the forward axis (around X axis), Tilting your head, (0=Straight, +Clockwise, -CCW)
| T UE::Math::TRotator< T >::Yaw |
Rotation around the up axis (around Z axis), Turning around (0=Forward, +Right, -Left)
|
static |
A rotator of zero degrees on each axis.