Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Correcting Orientation from external source (Oculus Rift)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2014

    Correcting Orientation from external source (Oculus Rift)


    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.
    Last edited by tmason; 09-10-2014 at 08:50 AM. Reason: grammar

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts