Hello,
So I have a weird issue with orientation when I am pulling orientation data from an external device, in this case the Oculus Rift.
Essentially I can get the correct position without an issue but my orientation is screwed up such that either looking up means I am looking down in the OpenGL environment OR looking left means I am looking right in the environment.
Obviously I would like it such that I am looking in the right direction at all times.
So, here is my code example:
[code=auto:0]glm::mat4 BulletOrientationMatrix = glm::mat4(1.0f);
ovrMatrix4f OculusRiftOrientation = OVR::Matrix4f(Current_HeadPose[EyeToCalculate].Orientation).Inverted();
for (int o = 0; o < 4; o++) {
for (int i = 0; i < 4; i++) {
BulletOrientationMatrix[o][i] = OculusRiftOrientation.M[o][i];
}
}
AdjustedPitch += HorizontalAngle;
HorizontalAngle = 0;
BulletOrientationMatrix = glm::transpose(BulletOrientationMatrix);
BulletOrientationMatrix = glm::rotate(BulletOrientationMatrix, AdjustedPitch, glm::vec3(0.0f, 1.0f, 0.0f));
As you can see, I copy over the orientation data from the Rift's SDK and then do corrections on it.
I am sure I am doing it in the wrong order or something; but I tried the code above with/without the inversion and vice versa with the "glm::transpose" call.
Is there something that maybe someone else sees in the code above that I am doing wrong?
Thank you for your time.