cancel
Showing results for 
Search instead for 
Did you mean: 

Getting head orientation

yasdawasda
Honored Guest
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 8

yasdawasda
Honored Guest
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?

yasdawasda
Honored Guest
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
Expert Protege
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!

standtall007
Protege
Hi kersk, does this also work if i want to get a character to turn in the direction the player is looking at?

jkafkaris
Explorer
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.

palii90
Protege
In Unity you can get the head orientation from the camera transform.
https://docs.unity3d.com/Manual/VROverview.html#UnderstandingTheCamera

jkafkaris
Explorer
Thanks palii90. Started using the transform of the CenterEyeAnchor in the OVRCameraRig.




himmelmax
Honored Guest
// 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