The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
From Unreal Wiki, The Unreal Engine Documentation Site
The type rotator is not a built-in type, but a struct defined in the Object(RTNP, U1, U2, U2XMP, UDK, UE2Runtime, UT, UT2003, UT2004, 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:
- 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)
- 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.
|This article related to UnrealScript or the UnrealScript API is a stub. You can help Unreal Wiki by expanding it.|
|Declarations||Preprocessor • Classes • Interfaces • Cpptext • Constants • Enums • Structs • Variables (Metadata) • Replication block • Operators • Delegates • Functions • States • Defaultproperties (Subobjects)|
|Types||bool • byte • float • int • name • string • Object • Class • Enums • Structs (Vector ⋅ Rotator ⋅ Quat ⋅ Color) • Static arrays • Dynamic arrays • Delegates • Typecasting|
|Literals||Boolean • Float • Integer • Names • Objects (None ⋅ Self) • Vectors • Rotators • Strings|
|Flow||GoTo • If • Assert • Return • Stop • Switch • While • Do...Until • For • ForEach • Break • Continue • FilterEditorOnly|
|Specifiers||Super • Global • Static • Default • Const|
|UnrealScript||Syntax • .UC • .UCI • .UPKG • Comments • #directives • Native|