Download

Rotation in x, y axises follow Right Hand Rule

The UE4 Coordinate is Left Handed.
(Let the Axis position direction facing you, so clockwise and counter-closewise are defined. Or use left hand thumb face axis positive direction and then other four fingers direction is the positive (clockwise direction, left handedness rotation). If follow your right hand then it is counter-clockwise direciton, and right handedness rotation)

The z axis rotation seems correct, it follows Left Hand Rule. Clockwise rotation is positive.
But x, y axis rotations follow Right Hand Rule. Clockwise rotation is negative.

It is all fine in Unity.

Orignal expressions
86fac2336f3b60e983748d8179cbc09419f3ea7a.png


    
     FQuat RotationQuat;
     RotationQuat.W = CR*CP*CY + SR*SP*SY;
     RotationQuat.X = CR*SP*SY - SR*CP*CY;
     RotationQuat.Y = -CR*SP*CY - SR*CP*SY;
     RotationQuat.Z = CR*CP*SY - SR*SP*CY;

It is clearly that X, Y’s signs have been fliped.

The conversion from Quaterion to Euler Angle is the same. X, Y components in Quaterinon have been fliped, too according to orignal expressions.

I never noticed that before. I got curious. If you open up a half professional modelling program (I popped open Modo for example since its stock Y up like Unity) and Y,X and Z clockwise are all neg, whereas Blender Y CW is +, X CW is -, and Z CW is -, opposite as you suggest UE4’s rots are which brings us to the industry standard, Maya Y (up) CW is -, X CW is -, Z CW is + just like UE4 uses. So that shows a possible connection/reason.

It will be fine.
But almost every 3D software, Game Engine, and VR Engine using either Left Hand Coordinate with Left Hand Rotation Rule(X Clocksise +, Y Clockwise +, Z Clockwise +) or Right Hand Coordinate with Right Hand Rotation Rule (X CounterClockwise +, Y CounterClockwise +, Z CounterClockwise +). These systems are more nature and friendly for most human beings. Mixing Different Rotation is OK, but it is odd to most people and no 3d software adopt it.

Sorry to wake up this old subject, but it came up in a Google search and I don’t want others to be confused.

No, Unreal does not mix rotations. The math is actually the same (the numbers are the exact same) in left-handed and right-handed systems.

  • The X vector, rotated positive around Z, yields the Y vector. This is the same in left-handed and right-handed coordinate systems. In a left-handed coordinate system, this yields the left-hand rotation rule.

The two other cardinal rotations of this basic rule also hold:

  • The Y vector, rotated positive around X, yields the Z vector. In a left-handed coordinate system, this yields the left-handed rotation rule.
  • The Z vector, rotated positive around Y, yields the X vector. In a left-handed coordinate system, this yields the left-handed rotation rule.
    The only case you will be confused is if you somehow use the wrong hand or wrong rule when interpreting the coordinate systems.

You can’t look at the implementation of a mathematical operation, and tell whether the coordinate system the user chooses to use is left-handed or right-handed.
The difference between left-handed and right-handed coordinate systems is ONLY when translating to/from a physical (real-world) context.

The math rules are absolutely the same, same numbers, same order, same everything, in a left-handed and right-handed system. The “mirroring” only happens when you choose to interpret the output numbers one way versus the other.

(haha, I’m here too cuz I was confused and Google led me here)

The way it confused me was that I was trying to remember which direction positive rotations are relative to the positive directions of each axis, and that’s how they appear inconsistent. If the +X or +Y axes are pointed directly at your eye, positive rotations are counterclockwise. If the +Z axis is pointed directly at your eye, a positive rotation is clockwise. I’m not suggesting it’s wrong, just saying that that /apparent/ inconsistency is what’s confusing (and, for me, hard to remember :slight_smile: ).

It doesn’t seem to be correct. X vector rotated 90 degrees around Z, does yields Y, BUT:
The Y vector, rotated positive around X, yields negative Z vector
The Z vector, rotated positive around Y, yields negative X vector

I need to work with quaternions and this brought some confusion. Obviously the coded maths works fine, it’s just a bit strange that indeed the left-hand rule is not consistently applied here. This is also visible in Henry Read’s formulas in #2 post.

See, pictures attached:

Identity (0 rotations)


Yaw = 90 degrees (rot around Z)

Roll = 90 degrees (rot around X)

Pitch = 90 degrees (rot around Y)