Is unreal rotator x and y flipped?

Noticing some weird results from my matrix math, hope there’s someone who can enlighten me.

here’s a quick rundown of what I observed:

  1. create an actor in the world, let’s set its rotation as [-14.928097, 36.161085, 31.678081]

  2. use the API and get the transform matrix, here I’m using the following code

actor = unreal.EditorLevelLibrary.get_selected_level_actors()[0]
xform = actor.get_actor_transform()
matrix = xform.to_matrix()
  1. now use an external transformation matrix library, I’ve tried Maya’s openmaya api, transformations and transform3d to decompose the transform matrix and extract the rotation as euler angles

  2. the result is [14.928097, -36.161085, 31.678081]
    as you can see, x and y is flipped,

note: I’m using ‘sxyz’ as rotation order, which based on my search is the one to go, I also tried all 24 combinations and non of which returns the same as input, so I guess that rules out the rotation order issue.

if I use unreal API again, unreal.MathLibrary.matrix_get_rotator(matrix), the rotation matches the input.

Hey @Redistind09, I think the issue here is the different coordinate systems. Here is an illustration extracted from https://www.techarthub.com/a-practical-guide-to-unreal-engine-4s-coordinate-system/.

Bottom line is, you probably can’t use Maya’s library, at least not directly without implementing an adaptation for Unreal.

Hope this helps

Thanks for the reply, I’m actually doing everything within Unreal’s coordinate system.
(I’m using Maya’s API merely as a math library so are the other two libraries)