Roblox UtilitiesDevlHub Roblox Documentation

Enum

RotationOrder

The order of rotation axes used for Euler angles encoding of rotations.

Euler angles encode a rotation in 3D space via a sequence of three rotations along the X, Y, and Z axes. The RotationOrder enum specifies the order in which the engine performs these rotations.

To help visualize the many rotation orders, you can test them manually in Studio with the Rotate tool or by inserting task.wait() statements between individual rotations of a cube with a unique face:

Luau
local cube = Instance.new("Part")
cube.Shape = Enum.PartType.Block
local rx, ry, rz = math.rad(90), math.rad(90), math.rad(90)

task.wait(5)
cube.CFrame *= CFrame.fromEulerAngles(rx, 0, 0)  -- X
task.wait(5)
cube.CFrame *= CFrame.fromEulerAngles(0, ry, 0)  -- Y
task.wait(5)
cube.CFrame *= CFrame.fromEulerAngles(0, 0, rz)  -- Z

An equivalent operation is:

Luau
local cube = Instance.new("Part")
cube.Shape = Enum.PartType.Block
local rx, ry, rz = math.rad(90), math.rad(90), math.rad(90)

cube.CFrame = CFrame.fromEulerAngles(rx, ry, rz, Enum.RotationOrder.XYZ)

Items 6#

NameValueSummary
XYZ0X, Y, Z order.
XZY1X, Z, Y order.
YZX2Y, Z, X order.
YXZ3Y, X, Z order.
ZXY4Z, X, Y order.
ZYX5Z, Y, X order.