My program doesn't have bugs. It just develops random features.

Rotator

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

The type rotator is not a built-in type, but a struct defined in the Object(RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT2004, UDK, UT3) class of all Unreal Engine games. Rotator values can describe an orientation in three-dimensional space (a "rotation") or a change thereof. (for example a rotation rate) The Object class defines a number of operators and functions for working with rotator values.

The three rotator components are pitch (think nodding to say "yes"), yaw (shaking your head to say "no") and roll (tilting your head sideways while looking in a specific direction). Each of them is of type int, so it can take values in the range -2147483648 to 2147483647. One full rotation (360 degrees or 2π radians) around an axis corresponds to 65536 units. When determining an orientation from a rotator value, the following rules apply:

  1. Start by facing in the direction of the positive X axis, with "up" corresponding to the positive Z axis. The Unreal Engine uses a left-handed Cartesian coordinate system, so by definition the positive Y axis is on the right side. ("left-hand rule": if the index finger of your left hand points forward, the thumb upwards, then the middle finger must point to the right)
  2. First apply the yaw component by rotating around the Z axis (the thumb) to the right for positive or left for negative values. (turn the index finger towards the middle finger for positive values)

Important: Because rotator components are of type int, precision is limited. Especially small rotation rates may be hard to achieve due to integer round down. Additionally, rotator components are compressed to the size of a byte for replication, resulting in a loss of precision as if the components had been affected by the operation component & 0xFF00. For obvious reasons this makes replicating rotation rates as a rotator value almost impossible.