Hi all, I'm a newbie developer and currently work for a museum. I want to control a 360 degree video without using the controllers. I am using the "isuserpresent" function to play / pause / stop the video. Everything works fine in the runtime (oculus Link) but when I build it doesn't. Does anyone have any idea where the problem is ? I work with Unity 2019.4 + Bolt + Oculus integration 23.1
Hey, You could try using CommonUsages.userPresence. https://docs.unity3d.com/ScriptReference/XR.CommonUsages-userPresence.html Example as below: Code (CSharp): InputDevice headDevice = InputDevices.GetDeviceAtXRNode(XRNode.Head); if (headDevice.isValid) { bool userPresent = false; bool presenceFeatureSupported = headDevice.TryGetFeatureValue(CommonUsages.userPresence, out userPresent); Debug.Log("presence feature supported " + presenceFeatureSupported + " userPresent is " + userPresent); }
this works fine but not work with openXR on quest 2 (works on editor but NOT on build) Any way to let it work with OpenXR?
You could make an OpenXR feature and override OnSessionStateChange() to check for user presence. The input parameters map to this enum, and you could consider XR_SESSION_STATE_FOCUSED as a state where the user is present
Hello, I am actually working on a Pico headset and found out PXR_SDK does have the provision where we can detect if the headset is removed or not. Can someone suggest me what would be the best option for me to detect if the headset is removed or not in the android build. Unity version:2021.3.21 Thanks
Just tried this. Works nicely. The runtime basically cycles through XR_SESSION_STATE_IDLE all the way to XR_SESSION_STATE_FOCUSED and back(obviously in reverse order) when someone puts the headset on and takes it off. Seems like a perfect workaround at least in-editor. Are there any pitfalls to this method?!
The main things I can think of is: You'll generally be moving between XR_SESSION_STATE_FOCUSED and XR_SESSION_STATE_VISIBLE whenever you press the oculus button to bring up the system menu (as far as I can remember!), so if that matters in your case you might want to take it into account. If you are using SteamVR as your OpenXR runtime, they used to keep you in XR_SESSION_STATE_FOCUSED state, regardless of whether the headset had presence or not. It's been a while ago since I tested this though so it might be different these days.
Ah nice. I have mapped through testing other states, but hadn't checked to see what happens with the system menu. Not using SteamVR, Meta's for Windows.
Hi guys, Please test this possible solution I have on StackOverflow: https://stackoverflow.com/questions...ect-when-the-hmd-is-removed/77821547#77821547 I've tested it on the Quest in Editor, can someone test it on other systems. I'll test on the Quest on a build when I have a little more time...
I've been my own tests checking user presence and it seems that different headsets seem to behave differently. With the Vive Pro headsets, using the method above to check presence and polling each frame does appear to work. Code (CSharp): headDevice.TryGetFeatureValue(CommonUsages.userPresence, out userPresent) However when using Vive Focus 3 and streaming to the headset via Vive Streaming HUB, it doesn't seem to consistently detect the headset is taken off. ---- In the case of detecting presence as native app on a Focus 3, using this plugin asset from the asset store has worked for me. https://assetstore.unity.com/packages/tools/integration/pa-proximity-25685
Some updates on user presence with OpenXR: recently a new extension was merged into OpenXR spec: https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_user_presence, which will provide accurate data to indicate if user is wearing the headset or now. We will expose new public APIs in the OpenXR plugin for users to query. Stay tuned for future OpenXR plugin releases.