Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
DauBe's avatar
DauBe
Honored Guest
11 years ago

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

  • drash's avatar
    drash
    Heroic Explorer
    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!