GodotVR / godot_openvr

GDExtension-based OpenVR module
MIT License
229 stars 35 forks source link

Anyway to detect if HMD is connected? #115

Open Albertolopezs opened 3 years ago

Albertolopezs commented 3 years ago

Hello,

I'm developing a 3D game which offers both VR and desktop environment. I want to allow the users to select the mode they want to play but only if the HMD is connected. Is there any way to detect it?

Thanks in advance.

BastiaanOlij commented 3 years ago

Not at the moment, I do believe OpenVR has a way for us to query this. I will have to investigate and see if I can implement something for it.

CrispyPin commented 3 years ago

The function is vr::VR_IsHmdPresent() https://github.com/ValveSoftware/openvr/wiki/API-Documentation#other-functions

It does not guarantee that vr can start, but is still the fastest way to check. The docs states that this is exactly the kind of use case for it though.