Detecting whether HMD is being worn

I need to query whether the rift is being worn (using the proximity sensor) in order to pause/unpause the game. (currently it stops rendering but continues to tick) Is there a blueprint function for this?

I thought it might be GetVRFocusState, but that appears to return true for “has focus” regardless of whether the rift is currently being worn.

Thanks in advance,

Erin Tomson
Oculus Story Studio

Measure the expected distance of the player to the sensor, if it is greater than this range, call an event that pauses the game. Once the sensor picks up the HMD within the expected ranges again, then unpause the game.

This can be done with using the Get Positional Tracking camera Parameters and the Get Orientation and Position.

We were looking for the proximity sensor value in the HMD (the small IR sensor that detects whether the HMD is on the user’s head) not the distance of the HMD from the tracking sensor. FYI for anyone else who comes across this, we ended up modifying the engine so that GetVRFocusState corresponds to the HmdMounted flag from the libovr session status. I’m not sure if that’s the intended meaning of “HasVRFocus” or not, but it works for us.

Interesting, never knew that existed! Thanks for letting us know the trick :slight_smile:

It’d be an interesting play mechanic to have the VR HMD be like a real helmet that changes the game mode. For example putting it on to control your mech, or to see ghosts, etc etc. Could even do a thing where it’s like your monitor is just Skyping with some military brass and they order you to put the headset on to control a robot or drone or something. Lots of opportunity for fun things there.

I am wondering how you modified the engine to change the behavior - having the same issue with gear vr app continuing to run. any help?

I’d also be very interested to hear if (and how) it is possible to render the game to the monitor when the hmd isn’t worn, then switch to entirely different VR mode when player puts it on.