Romain Posted April 6 Share Posted April 6 Hello, I'm working with Vive Focus 3 and Unity and the fact that the Unity Update function stops to run as soon as the user remove the headset and the screen is turned off is a bit problematic for me. During my experimentation I saw that threads are still running when the screen is turned off so to understand better what happens when the screen is turned off I tried to use WVR_PollEventQueue in a thread to see what events where triggered. My expectations according to the WVR_Event documentation were that when the screen is turned off I should receive the event WVR_EventType_RenderingToBePaused and when the screen turns back on the event WVR_EventType_RenderingToBeResumed but these events are never triggered or at least they never appear when I log the events queued in WVR_PollEventQueue. I am able to log other event like WVR_EventType_DeviceStatusUpdate or WVR_EventType_BatteryStatusUpdate so I know that some events works well but I never receive the event I was expecting. Am I missing something, is this normal I never see these events ? I also saw in code comments that the events WVR_EventType_DeviceSuspend and WVR_EventType_DeviceResume that are obsolete were also triggered by removing and putting on the headset. Since, they are now obsolete my guess was they have been replaced by RenderingToBeResumed and RenderingToBePaused but I also saw that there is a call WVR_IsDeviceSuspend in the native SDK so I tried to use it thinking that it would return true when the user take off the headset but it always returns false. Is WVR_IsDeviceSuspend also obsolete ? If it's not the case when should it's value be changed from false to true ? Thanks and have a great day ! Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted April 7 Share Posted April 7 Hi @Romain, According to the document, you should not use WVR_PollEventQueue. To receive the WVR_EventType_RenderingToBePaused and WVR_EventType_RenderingToBeResumed you refer to the WaveEssence.cs. Instead of listening to events, you can check the CommonUsages.UserPresence value. Link to comment Share on other sites More sharing options...
JulienActiveMe Posted August 22 Share Posted August 22 Hello, @chengnay I'm trying to listen to this WVR_EventType_RenderingToBePaused event by putting this line in a monobehavior in the OnEnable() function, just like it is recommended in the documentation (https://hub.vive.com/storage/app/doc/en-us/UnityXR/UnityXREvents.html) I'm expecting it to be fired when the player takes the HMD off and the staff presses the back button of the HMD. WVR_EventType_RenderingToBePaused = 1010 Notification for the rendering is going to be paused due to user take off HMD and display off. Event is NOT fired. (I tried using WVR_EventType_DeviceDisconnected but it seems to be deprecated in the last version of the sdk) I can catch the WVR_EventType_ButtonPressed event however, so I really think there has to be something wrong somewhere. I tried checking the CommonUsages.UserPresence like so : private void GetUserPresence() { InputDevice headDevice = InputDevices.GetDeviceAtXRNode(XRNode.Head); if (headDevice.isValid) headDevice.TryGetFeatureValue(CommonUsages.userPresence, out userPresent); } but it always returns true, disregarding the fact that the HMD is on or off. How can I catch the event of the HMD going to sleep, or the user taking off the HMD ? Am I doing something wrong here ? It seems such a basic feature why is it so complicated to get right ? Thanks in advance ! Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted August 23 Share Posted August 23 Hi @JulienActiveMe, May I know which Wave SDK version did you install? Thanks! Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted August 23 Share Posted August 23 21 hours ago, JulienActiveMe said: How can I catch the event of the HMD going to sleep, or the user taking off the HMD ? You can put some code under OnApplicationPause(), for examples, void OnApplicationPause(bool pause) { if (pause) { // when HMD goes to sleep } else { // when user puts on HMD } } Could you try above code? Thanks! Link to comment Share on other sites More sharing options...
JulienActiveMe Posted August 23 Share Posted August 23 Hello @chengnay, Thanks for your response. My version of the SDK is 5.3.2. I tried putting some code in the OnApplication pause like you suggested. I only get the event when the HMD is waking up, not going to sleep. I managed to find a workaround, but I don't like it. It does fit my purpose however and I'm limited in time so I'll keep it for now. There is a unity package called PA Proximity that detects the proximity of the sensor inside the HMD. https://assetstore.unity.com/packages/tools/integration/pa-proximity-25685 The prinicple is simple, just subscribe to to the event of the change of the status of the proximity sensor and do what you want when you get it. Is there a way to put the HMD to sleep from a script though ? For now, I do Application.Quit() when I gete the event, but the HMD stays awake for three more minutes before going to sleep (3 minutes is the lowest value you can set in the LBE settings). I find it a bit annoying to use a third party package to be able to manage this. Anyway, it fits my needs and I'll go with it for now. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted August 23 Share Posted August 23 12 minutes ago, JulienActiveMe said: I only get the event when the HMD is waking up, not going to sleep. Sorry, I forgot to mention it takes 3 mins to trigger OnApplicationPause after HMD is off. Link to comment Share on other sites More sharing options...
JulienActiveMe Posted August 23 Share Posted August 23 Ok, now I understand. But this doesn't seem natural. Anyways, could you please tell me if this is possible ? Quote Is there a way to put the HMD to sleep from a script though ? For now, I do Application.Quit() when I gete the event, but the HMD stays awake for three more minutes before going to sleep (3 minutes is the lowest value you can set in the LBE settings). Thank you ! Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted August 23 Share Posted August 23 To clarify your question, You get the event(status of proximity sensor) and do Application.Quit(). I assume you will get status from proximity sensor right after you took off the HMD? You mentioned three more mins(should be the same as I mentioned above that OnApplicationPause will take 3 mins to trigger after HMD off). May I know the LBE settings, what is this about? Is this settings in Vive headset? Link to comment Share on other sites More sharing options...
JulienActiveMe Posted August 23 Share Posted August 23 Quote I assume you will get status from proximity sensor right after you took off the HMD? Exactly. Quote You mentioned three more mins(should be the same as I mentioned above that OnApplicationPause will take 3 mins to trigger after HMD off). May I know the LBE settings, what is this about? In the LBSS (VADMS) Batch configuration of the group my device belongs to I can put a delay for the HMD to go to sleep after a certain inactivity. For now, the lowest possible value is 3 minutes. This means that after my user takes of the headset, and puts it back in the rack, it will take 3 minutes before going to sleep mode. 3 minutes is a lot, is there a way I can put the HMD to sleep from script? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now