Skip to main content
New Participant
April 16, 2015

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

    Inspiring
    April 16, 2015
    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);
    }
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    lhsdanielAuthor
    New Participant
    April 17, 2015
    "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?
    Inspiring
    April 17, 2015
    Please start by reading the documentation.

    https://developer.oculus.com/documentation/
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV