exokitxr / exokit

Native VR/AR/XR engine for JavaScript 🦖
MIT License
992 stars 117 forks source link

Battery info for controllers #63

Open shawwn opened 6 years ago

shawwn commented 6 years ago

I noticed in some VR game -- I think VRChat -- that you can see the battery level for each controller.

I wanted to add this feature to my own site, but it seems that the WebVR spec doesn't provide the info.

Is there a way battery level could be provided to sites anyway? What would that look like?

We can do something like:

if (navigator.userAgent.startsWith("MixedReality")) { .... }

But that's cumbersome and prone to breakage; probably the worst way to do it.

avaer commented 6 years ago

Probably can pull from openvr. I wouldn't do a UA detect, but rather a feature detect though.