What is the rotation order for Components or Bones?

I’d like to know the default rotation order used in the engine, and whether it’s the same for components and bones etc.

I’m guessing XYZ?

Thank you.

Looking at RotationTranslationMatrix.h, I’m pretty certain the order is Roll (applied first), Pitch, then Yaw.

So the order is X, Y, then Z, which makes sense, because you want the most commonly manipulated axes (yaw and pitch) to be applied lastly.

You could always confirm this in the editor by rotating a mesh around and see which axis encounters gimbal lock. The axis applied last will never encounter a gimbal lock.

2 Likes

Thanks for your quick reply thavlik. I replied earlier but it didn’t seem to get posted, odd.

Do you mean Pitch (X) then Roll (Y) then Yaw (Z)? In the top view in the Editor X is running left to right so that would be Pitch, i.e. looking up/down.

The middle axis is the one that causes gimbal lock, and that seems to be correct in the Editor. If I rotate something 90 degrees in Y then it’s not possible to get a Pitch rotation, both X and Z rotations effectively give a Yaw rotation. So Y is gimbal locking.

Just need to confirm whether it’s XYZ or ZYX now! The last axis is usually the most important so I think you’re right with it being XYZ.

I would’ve expected this to be in the docs, but I couldn’t find it. Does anyone know where this is described?

Thanks again.

Usually +X is forward (my college professors always taught this) but Epic might have chosen +Y so that way your +X axis is pointed towards the right.

You can check to see which is the forward vector by changing the roll. If it rotates around X, it’s the X axis. Otherwise it’ll be Y.

Does anyone know for certain what the rotation order is?

The short answer:

World Space rotation order: XYZ

Local Space rotation order: ZYX

=====

The rotation order in terms of World Space is XYZ.

A simple test:
Select an actor in your scene. Make sure you’re in Rotation Mode (or press E).

Rotate around the X axis an arbitrary amount, like 50 degrees.

You’ll notice that as soon as you finishing rotating, the rotate tool will look exactly the same, with the Red, Green, and Blue rotate handles oriented the same way. This is because you’re rotating in World Space. If this were local space, the handles would rotate with the object.

Note the rotation value that shows up in the Detail panel is the same amount you rotated by.

Next rotate around the World’s Y axis by an arbitrary amount, like 20 degrees.

In the detail panel, the X rotation value will be the same, but now the Y value should reflect how much you just rotated by.

This is because the X rotation is independent of the Y rotation. If you rotated around the Y axis first and then the X axis, you’d notice that the Y rotation value would change. This is because the Y rotation is dependent on the X rotation.

Finally, rotate around the World’s Z axis by an arbitrary amount. Try rotating in any other order. You’ll notice values change unexpectedly.

=====

Conversely, if you want to rotate in local space, simply reverse the rotation order: ZYX.

A simple test:
Select an actor in your scene. Make sure you’re in Scale Mode (or press R). This is just to show you the actor’s local axes.

Using the Transform section of the actor’s detail panel, set the Z rotation to an arbitrary value, like 45.

You’ll notice your actor has rotated around its Z axis (the blue axis).

Now setting the Y rotation to an arbitrary value will rotate around the actor’s local Y axis. Notice the cube representing the actor’s Y axis hasn’t moved in space.

Finally, setting the actor’s X rotation will rotate it around its local X axis.

I know this is very late, but I solved an issue for a friend trying to create a direct link from Maya into Unreal. What we found is that the rotation order that preserved the modifications made in Maya correctly was XZY. That is rotations that were applied in Relative, and not World space.