Forum Discussion

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

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!

8 Replies

Replies have been turned off for this discussion
  • 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?
  • 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??
  • kersk's avatar
    kersk
    Meta Employee
    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!
  • Hi kersk, does this also work if i want to get a character to turn in the direction the player is looking at?
  • 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.
  • Thanks palii90. Started using the transform of the CenterEyeAnchor in the OVRCameraRig.




  • // 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