How to make use of the Proximity Sensor in Blueprints?

Does anyone know how to make use of the proximity sensor on the Rift using Blueprints? I’d like to be able to have my experience play/pause/restart when the headset is taken off and on. I can’t seem to figure out how to do this. Some help would be greatly appreciated!

Bumping this as I see this to be a pretty important issue. Is there really no way to implement this? When I currently take the headset off during gameplay, the scene is no longer rendered, but I can still hear audio and all of my events are still ticking.

Bumping this yet again. I don’t understand how most people aren’t asking about this feature, it seems to be a pretty crucial one for creating a VR game and it’s not documented anywhere whatsoever.

Bumping again.

I remember the good old time when you had an answer from one of the Unreal dev guys in less than an hour… but thats when we had to pay every month for UE4

Yeah, the good old days :frowning: … It’d be really nice if someone would spread their knowledge about the proximity sensor. I think it’s crazy that there wouldn’t be some blueprint node for a hardware feature as simple as this. This is absolutely essential to my project as it will be demoed in public all day every day and I can’t be there to restart the experience every 2 minutes. Come on Unreal Devs, throw me a bone here!

Its not possible atm. Also, after working with the vive’s proximity sensor (in code), its not that great and half works (basically there is a weird delay). Hopefully valve can iron the issues out and make it more consistent. But either way, I’ve entered the new feature request as UE-34593

Thanks for the reply and the feature request KRushin, it’s much appreciated! I was feeling pretty alone in this situation for a little while there. If there’s not a way in blueprints, do you know of a way in code?

Ok, I’ve done a preliminary code up of getting access to some of the proximity sensor stuff and also detecting when the user opens oculus home, I added it to the VR Notifications component as 4 new delegates that you can use to detect these things:

They correspond to the guidelines on the Oculus developer docs found here

@NCMcClure If you want to integrate these changes into you own 4.12 branch they can be found on my

I originally tried to get all this working just as a plugin but the Oculus Plugin doesn’t allow you to get access to the oculus service to check for the proximity sensor outside of itself, so that was a no go.

Currently I’ve only implemented it for the Rift but the Vive will be easy,

and also @KRushin what your seeing with the vive’s proximity is actually by design (see here)

Anyway hopefully if epic finds this useful they will accept it as a PR so others don’t have patch it in themselves

Thanks,

Edit: It seems that the vive doesn’t even use the proximity sensor yet, the event that is supposed to be tied to the proximity sensor seems to just be triggered when the headset is moved after being stationary (like sitting on a desk)

Thank you! You’re a project (life?) saver! :smiley:

Hi all!

Thanks for this thread! I have also tried to find an answer to this. I actually posted a question similar here:

So is this working for you guys?
In UE4 v.4.14 I found the similar node “HMD Removed From Head Delegate” and vice verse. But I haven’t been able to get it to work. The only thing that happens when proximity sense no head is turning Oculus and monitor into black. My ideá was to have the monitor to i.e. add a 2D widget to screen when that happens.
Do you think “IsHMDEnabled” could work?

Thank you guys!

I made the one in HTCVive to work, but never used the one on Rift. It was having a great precision and made little changes, if you want me to post here I can.

Kind regards,

Hi Pekayatt,

If you’re able to give some more input here on that it would be great!

Kind regards,

The solution is to create some calls on the case of line 787 of SteamVRHMD.cpp (case vr::VREvent_TrackedDeviceUserInteractionEnded:) at least was that on 4.13

You must follow the delegates as in FCoreDelegates::ApplicationHasEnteredForegroundDelegate.Broadcast();, I have created a Broadcast to a VRNotificationComponent.

Just realize that I lost the modifications on a old version (4.12), so I will need to build it again hahaha.

If you have too much trouble please let me know.

Kind regards,

In my testing (and digging through the source) Epic added those delegates to the VR Notification component in 4.14 but never implemented them anywhere! Which is a real bummer, and makes me a little frustrated. But anywho I was thinking of fixing it and making a pull request (although its a pretty simple thing to fix and Epic has a pretty bad track record for accepting pull requests…)

In my testing SteamVR its self does not use the Vive proximity sensor, and unless this has been updated (which is quite possibly true) this would still run into the same problem as above (since my code is using TrackedDeviceUserInteractionEnded as well)

Yes, you need to dev the notifications yourself.

Believe me, I made it run on 4.12. So the SteamVR lib is capable of that. Maybe I will upload a fork with this again :wink:

Thanks for the inputs guys!

Alright so you have to dig in to source code or like C++? I’m not a programmer so excuise me for maybe obvious questions. Only been testing out blueprints. Ok, so the VR notification components hasn’t been fully ended for 4.14 to be able to work unless dev?
> Did you get your node setup with “HMD Proximity sensor detected” to work with the sound response in v.4.12 or?

Thanks guys!

The VRNotifications component still does not function properly (as of version 4.15.1, have not had proper time to dig into Robo Recall to see if one can figure out how it was done there) - no events are triggered even if the component is auto-enabled on either the Rift or Vive.

Anyone else had better luck? Will there be official support for this?

Bug tracker for the issue, vote for it if you are interested in resolving it: Unreal Engine Issues and Bug Tracker (UE-41448)

Meanwhile you can get at least a part of the functionality working by implementing the changes in this: https://.com/EpicGames/UnrealEngine/pull/3203/files pull request.

Ha ha, this wil be my first answer on the forum. There is a node called “GetVrfocus state” make a branch, and print something to the false or true state (whatever you like). for me it works.

I am making arduino light switches so when you put on the headset the lights in the house switch of and when you take of the headset the lights in the house switch on (saves electriciy and is a lot more immersive (no light leaking through the nose).

Hope it helped someone.

Very very late update but I found another way to get the state of the HMD. “GetVrfocus state” unfortunately didn’t work for me in UE 4.24.

I found the Node “Get HMDWorn State” which returns an enumeration that you can use to check if its being worn or not.

I hope this helps some people who are still looking for an answer :slight_smile:

4 Likes