OVRDisplay.acceleration always returns (0, 0, 0)

Not sure why this is happening. OVRDisplay.velocity returns the correct values, but OVRDisplay.acceleration always returns (0, 0, 0)? Angularacceleration seems to also return (0,0,0). Not sure how to fix this.

Using OpenXR? Or something else?
Can you share the full code?

If the docs don’t say anything about it and you tried on the latest version then make a bug report I guess

Yes, in OpenXR. I’m running Unity V2022.2.0f1.

As you can see, the code isn’t very interesting; I’m using calls from the Oculus SDK, which I believe are built on OpenXR. The native Unity XR methods return the same result (0, 0, 0).

private OVRDisplay ovrDisplay;

private void Awake()
{
        ovrDisplay = new OVRDisplay();
}

  private void Update()
{
        // Calculate acceleration components of HMD
        float hmdAcceleration = ovrDisplay.acceleration;

{

You use New OVRDisplay().
Have you seen any reference code for this?
I feel like normally you would get this from a system instead of making a new one.

You are correct, I have changed it to ovrDisplay= OVRManager.display. But the problem still persists and neither the Unity nor Oculus documentation indicate that getting hmd acceleration is more complicated than calling ovrDisplay.acceleration.

Hmm this also doesn’t help much.
Is it both PCVR and quest native?
And does it work of you use the oculus xr plugin?

No it’s never worked for me yet. The code above is using the Ouclus XR plugin (note the ovr prefix = oculus vr)

I believe you linked an alternate implementation, maybe from a depreciated OVRDisplay file, since mine (taken from the newest version of Oculus XR Plugin) looks like this

///


/// Gets the current linear acceleration of the head.
///

public Vector3 acceleration
{
get {
if (!OVRManager.isHmdPresent)
{
Debug.Log(“zero”);
return Vector3.zero;
}

Vector3 retVec = Vector3.zero;
if (OVRNodeStateProperties.GetNodeStatePropertyVector3(Node.Head, NodeStatePropertyType.Acceleration, OVRPlugin.Node.Head, OVRPlugin.Step.Render, out retVec))
return retVec;
return Vector3.zero;
}
}

Either way, both implementations are similar; I don’t think OVRNodeStateProperties is open source though so can’t look into that.

it seems TryGetAcceleration from OpenXR also returns (0, 0, 0). This could be a step towards the root of the problem since Oculus XR is most likely an extension of OpenXR.

Isn’t the OVR code from oculus integration?
You can use it with both openxr and oculus xr plugin, but might act differently

I think it’s both, but I could be wrong. Either way, I tried to get acceleration from OpenXR, Oculus Integration and Oculus XR and they all return (0, 0, 0), so now I’m annoyed