Forum Discussion

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

how to get the head roration parameter?

So I would like to make a camera rotate as rift users rotate their head. I think there is a build-in parameter that I could directly get from rift. Could somebody instruct me on how to do so?

3 Replies

  • Yes, it shows this in the documentation. Here are the relevant lines (in C++):

    frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); 
    ovrTrackingState ts = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds);

    if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)) {
    Posef pose = ts.HeadPose.ThePose;
    float yaw, pitch, roll;
    pose.Rotation.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll);
    }
  • "cybereality" wrote:
    Yes, it shows this in the documentation. Here are the relevant lines (in C++):

    frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); 
    ovrTrackingState ts = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds);

    if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)) {
    Posef pose = ts.HeadPose.ThePose;
    float yaw, pitch, roll;
    pose.Rotation.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll);
    }




    Thank you! but I mean I am really new to oculus rift development. After I plug in oculus rift and set it up, I can just write a C++ program to fetch these parameters right?