Skip to main content
Participant
October 30, 2014

Getting head orientation

Feels like this should be a simple one, but I can't find it anywhere.

How do I get access to the rotation values for the head tracking? I want to use the head tracking values to control the pitch/yaw/roll on a simple airplane.

Thanks!
    This topic has been closed for replies.

    8 replies

    Participant
    October 30, 2014
    Finally got it...

    Quaternion hmdOrientation = new Quaternion();
    Vector3 hmdPos = new Vector3 ();

    OVRDevice.GetCameraPositionOrientation (ref hmdPos, ref hmdOrientation, 0);


    Is there an official reference or documentation to find this sort of stuff out quickly?
    Participant
    October 31, 2014
    Ok... so I've just got 0.4.3 and OVRDevice doesn't exist any more....

    There must be a reference manual for all this stuff??
    Meta Employee
    October 31, 2014
    Here you go -- this should work for you in the 0.4.3 SDK:
    OVRPose hmdPose = OVRManager.display.GetHeadPose();
    Quaternion hmdOrientation = hmdPose.orientation;
    Vector3 hmdPos = hmdPose.position;


    And you can find the full documentation here:
    https://developer.oculusvr.com/doc/?package=unity

    Hope this helps!
    Up and Coming
    November 1, 2014
    Hi kersk, does this also work if i want to get a character to turn in the direction the player is looking at?
    ASUS Maximus VII Formula Intel core i7 quad core 4790K OC'ed @ 4.4Ghz 32GB DDR3 Ram Nvidia Geforce GTX 980 4GB Windows 10 Pro 64bit GSync Monitor @ 2560x1440, 144Hz ------------------------------------------- DK2 Owner CV1 Preordered.
    Participant
    November 9, 2017
    Sorry to rehash an old post, but I'm trying to do the same now but I don't see GetHeadPose anymore. And the link to the docs does not work.

    Thanks.
    Inspiring
    November 9, 2017
    In Unity you can get the head orientation from the camera transform.
    https://docs.unity3d.com/Manual/VROverview.html#UnderstandingTheCamera
    Participant
    November 10, 2017
    Thanks palii90. Started using the transform of the CenterEyeAnchor in the OVRCameraRig.




    New Participant
    December 27, 2018
    // Doesn't look like this will work for Oculus Go ... :/

    Vector3 PlayerHeadPos = Vector3.zero;

    OVRNodeStateProperties.GetNodeStatePropertyVector3( UnityEngine.XR.XRNode.Head,
    NodeStatePropertyType.Position,
    OVRPlugin.Node.Head,
    OVRPlugin.Step.Render,
    out PlayerHeadPos );

    // Edit: jkafkaris's suggestion worked for me