Skip to main content
New Participant
March 8, 2015

Hey newbie developer using unity

Hi Everyone,

I currently have a DK1 and i'm trying to Output the oculus's Y rotation values to an outside application using either TextWriter or some other drive connect. but i'm having trouble grabbing the Y rotation values and i don't know where they are updated. my end goal it to send these values to a java script any help is appreciated thanks!

    1 reply

    Inspiring
    March 8, 2015
    Here's some code to do this. Not 100% sure it compiles, but it should point you in the right direction:

    If you're using an old SDK for this (pre 0.4.3), you'll want to look at OVRDevice.GetPredictedOrientation().

    Quaternion currentOrientation = Quaternion.identity;
    OVRDevice.GetPredictedOrientation(0, ref currentOrientation);
    float currentOrientationY = currentOrientation.eulerAngles.y;


    If you're using a more recent SDK (0.4.3 and newer), you'll want to look at OVRManager.display.GetHeadPose().

    if(OVRManager.display != null)
    {
    OVRPose currentHeadPose = OVRManager.display.GetHeadPose();
    float currentOrientationY = currentHeadPose.orientation.eulerAngles.y;
    }


    Hope that helps!
    Titans of Space PLUS for Quest is now available on DrashVR.com