Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
VenomMouse's avatar
VenomMouse
Honored Guest
6 years ago

Check if OpenVR / SteamVR / OculusVR headset is mounted on your head

The Oculus and the Vive have this light proximity sensor that detects whether you have your VR headset placed on your head currently or not.

Is there any way to tap into that for our own game checks? E.g. We could pause or restart the game depending on whether the headset's being worn or not.

I'm using Unity/C#, but any (driver / API level) help is much appreciated.

1 Reply

  • No idea about steamvr, but in the oculus sdk:
    C#/Unity: OVRManager.isUserPresent is a bool that says if the headset is currently being worn. You can also register a delegate with OVRManager.HMDMounted and OVRManager.HMDUnmounted to get events when they happen.

    C++:
        ovrSessionStatus status;
        ovr_GetSessionStatus(g_HMD, &status);
        if(status.HmdMounted)
            // it's being worn



    E.g. We could pause or restart the game depending on whether the headset's being worn or not.


    Actually for single player games this is required behavior to get on the Oculus store: