HMD removed or put on

I have noticed that this code only says the user in present with a Vive

if (XRDevice.userPresence == UserPresenceState.Present)
        {
            Debug.Log("XRDevice.userPresence Present");

        } else if (XRDevice.userPresence == UserPresenceState.NotPresent)
        {
            Debug.Log("XRDevice.userPresence NOT Present");
        }

Correction this works, you just have to wait 10/20 seconds for the state to change

Thanks

I can confirm this in Unity 2017.3.1f1 – it takes about 10 seconds, with the Vive HMD lying on the table, before XRDevice.userPresence changes from “Present” to “NotPresent,” which is a problem when we want to run this check once at startup.

1 Like

The work around is to do detection with the Vive’s Proximity Sensor

1 Like

Right, that works thanks; for the moment I’m just replacing XRDevice.userPresence with the following:

var mounted = SteamVR_Controller.Input(0).GetPress(Valve.VR.EVRButtonId.k_EButton_ProximitySensor);

This works fine, though I feel like XRDevice.userPresence should be made consistent with this (rather than “poll the headset and set it to NotPresent after 10 seconds of inactivity”).

1 Like

This no longer works with the last big steamvr update. There’s no documented way to access the k_EButton_ProximitySensor

Hi guys, do you know how can do the same on the Oculus Go? I’ve tried but it doesn’t work…

1 Like

Not sure but since Go is running on Android, I would think the standard Application pause methods should work

The steam vr input system has changed, and since my last post, they have added ways to access the proximity sensor.

In case you still find some quirks for your version, check out their github repo issues section.

1 Like

Hey guys, I was wondering if the XRDevice.userPresence works for Oculus Go. Any ideas? Thanks