Transform modelview matrix from y up to z up

Hi,

I’m probably missing something obvious or I’m just too tired to think at the moment, but what is the multiply matrix to make a modelview matrix with a 0,1,0 up vector into one with a 0,0,1 up vector?

Background: The Oculus Rift SDK returns a y+ modelview matrix and my game expects a z+ one and while I could calculate it myself based on the roll/pitch/jaw I’m lazy :slight_smile:

Mike

Hi,

That rotate is what I performed but after that the forward vector didn’t work as it should have. Maybe there is something else that is incorrect as well. I’ll continue looking unless someone else has the absolute solution.

I always have the backup if it doesn’t want to work :slight_smile:

Thanks!

Mike

After trying things out for a bit I came to this solution for the problem. Maybe it’ll help someone else as well :slight_smile:

Posef eyePose = or.getEyePose(eye.Eye);
Quatf orientation = eyePose.Orientation;
Matrix4f modelViewMatrix = new Matrix4f(orientation.inverted());
Vector3f forwardVector = new Vector3f(modelViewMatrix.M[2][0], -modelViewMatrix.M[2][2], -modelViewMatrix.M[2][1]);
Vector3f upVector = new Vector3f(-modelViewMatrix.M[1][0], modelViewMatrix.M[1][2], modelViewMatrix.M[1][1]);

Mike