I am using the Oculus Quest with Unity 2018.4.22f1 and Oculus SDK. Moving into my application works well. But every time I want to get the position of the headset, the vector zero is returned.
I tried these solutions :
OVRPose tracker = OVRManager.tracker.GetPose();
return tracker.position;
And
GameObject camera = GameObject.Find("OVRCameraRig");
return camera.transform.position;
This is position tracking setup:
Do you have any idea how to get the headset position?
When I want to get the headset's position, I am using the transform.position
of the CenterEyeAnchor which is inside OVRPlayerController/OVRCameraRig/TrackingSpace
.
using UnityEngine;
public class YourScriptNameHere : MonoBehaviour
{
GameObject centerEye;
Vector3 headsetPos;
void Start(){
centerEye = GameObject.Find("CenterEyeAnchor");
}
void Update(){
headsetPos = centerEye.transform.position;
}
}