Search Unity

Accessing Oculus Rift acceleration or velocity without positional tracking

Discussion in 'AR/VR (XR) Discussion' started by SLEE23, Nov 16, 2017.

  1. SLEE23

    SLEE23

    Joined:
    Aug 9, 2017
    Posts:
    2
    Hi Everybody,

    I am trying to access the Oculus Rift CV1 acceleration or velocity in Unity3D. I am interested in the raw IMU data as well as a fused version. For my scenario it is important that positional tracking is disabled.

    By now I have tried the following code to get the Headset acceleration:

    Code (CSharp):
    1.  
    2. List<XRNodeState> nodeStates = new List<XRNodeState>();
    3. UnityEngine.XR.InputTracking.GetNodeStates(nodeStates);
    4.  
    5. foreach(XRNodeState ns in nodeStates)
    6. {
    7.  
    8.     Vector3 acceleration;
    9.  
    10.     if (ns.TryGetAcceleration( out acceleration)){
    11.         // do something with acceleration
    12.     }
    13.  
    14. }
    I get a result if one of the Oculus cameras is seeing the Rift. But if the Rift is not visible or the cameras are not connected the velocity and acceleration values are (0,0,0). As I mentioned I cannot use positional tracking in my scenario.

    Am I doing something wrong or is there a different way to access this information? Or are this values just not forwarded if positional tracking is disabled?

    Besides that I tried accessing the values with the help of Oculus Utilities 1.19.0 and its OVRDisplay class:

    Code (CSharp):
    1. OVRManager.display.acceleration
    I am not getting any values when using this code in the Update Loop.


    Thanks in advance! I am thankful for any help regarding this issue.
     
  2. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    Pretty sure you're not going to get acceleration data without the headset tracking. best to ask oculus directly in this case.
     
  3. kayb14

    kayb14

    Joined:
    Jun 12, 2016
    Posts:
    10
    just slap a kinematic, no gravity rigidbody on the game object that is controlled by the hmd
    and get the accelleration from that rigidbody.
    Just be sure that it's not the raw input of the hmd and that it's on a layer that doesn't collide with anything.