0

I have OpenGL (Right handed coordinates, Y-up, -Z forward) 4x4 transformation matrix that rotates the yaw correctly, but pitch and roll are flipped. Position is also correct.

Is there a way to flip the rotation around the z-axis to actually rotate around x-axis and vice versa?

Transformation matrix [
  x1 y1 z1 w1 
  x2 y2 z2 w2
  x3 y3 z3 w3
  0  0  0  1
]

I have tried to decompose T R S out of the matrix and multiplying only the rotation matrix with coordinate system changing matrices without success. E.g. I have tried:

Identity matrix with x and z flipped [
  0 0 1
  0 1 0
  1 0 0
]
Toothery
  • 155
  • 1
  • 1
  • 10
  • see [Is there a way to calculate 3D rotation on X and Y axis from a 4x4 matrix](https://stackoverflow.com/a/56950130/2521214) you just need to have 2 configs one for your source rotation `S` order and second for the desired one `D` then convert from `S` to some matrix `M` and then from `M` to `D` ... – Spektre Nov 09 '20 at 10:20

1 Answers1

0

The indices in the matrix are not corresponding to a certain axis, it might as well be labeled

[ e11 e12 e13
  e21 e22 e23
  e31 e32 e33 ]

check out this tutorial http://ogldev.atspace.co.uk/www/tutorial07/tutorial07.html