Euler Rotations and Matrix Questions

Regarding the rotation matrix creation. There seems to be an inconsistency in how Unreal creates it and standard convention. I’m assuming it was intentional, but it doesn’t make sense to me…

In order to generate the rotation matrix the code above shows, the basic rotations used are:

unreal_rotations.gif

Multiplied out and illustrating above code result (although transposed?)

Which do not match the standard:

standard_rotations.gif

Notice the sign of sines change for the rotation about Z. The usual pattern of signs for sine is upper-right/lower-left/upper-right or the transpose of that, however the code seems to use upper-right/lower-left/lower-left. After playing around in the editor I noticed that although the typical rotation direction (positive angle yields clockwise rotation about the axis when looking along the axis from the origin) apply for Pitch and Roll, it does not apply to the Z/Yaw rotations. I can’t imagine this is a bug, but I am curious why it was done this way. I doesn’t seem logical, why not keep it consistent and make all rotations clockwise along their axis? I am guessing that is the reason for the sign swap for the Z rotation sines and why I didn’t recognize the original code, but I am not 100% sure.

So to add to the previous understanding:

Yaw is rotation about Z-Axis (Up), positive rotation goes counterclockwise when looking along positive Z axis from origin?
Pitch is rotation about Y-Axis (Right), positive rotation goes clockwise when looking along positive Y axis from origin?
Roll is rotation about X-Axis (Forward), positive rotation goes clockwise when looking along positive X axis from origin?

Let me know if I have made some foolish mistake, just trying to make sense of things.
Thanks!