I just had to use cross product, and after some frustration with things rotating the wrong way w.r.t the environment, I realized that the UE4 is NOT right handed!!!
How come it is so? The Z vector is pointing in the wrong direction, or X/Y are flipped…
Is there a setting to make the world right handed?
Unreal Engine 4 (like Unity and other engines) uses a left-handed coordinate system.
I believe this is because DirectX was left-hand-centric in the past, so it became tradition for long-running, PC-centric video game engines, but I could be wrong.
Has always made sense to me. If you’re looking at a Cartesian plane then the top right quadrant is all positive, which is true if you’re facing forward (X+) in UE4
A compass is left handed (when seen from above.)
The math unit circle is right handed (when seen from above.)
Computer graphics traditionally evolved out of flight simulators, and thus tied conventions to compasses, and thus tend to be left handed.
Traditional mathematics (of which linear algebra is a branch) evolved based on the unit circle (the definition of sin/cos, X going right, Y going up) and thus tied conventions to right handed.
The good news is that the math is the same: If you take the X vector, and you rotate it 90 positive degrees around the Z vector, you will get the Y vector out. This is the same in left-handed and right-handed systems.
The difference lies in how you then interpret that positive Y coordinate, physically. In Unreal, positive Y goes right and positive X goes forward and positive Z goes up. Thus, the left-handed rotation around Z yields clockwise rotations (just like a compass.)
In traditional math, as far as it interprets reality at all, a positive rotation around the Z axes yields counterclockwise rotation. This is most obvious in the physics world, which got its physical conventions from traditional math, not from navigation.