Hi, I just realised that the bars at the bottom of the controller represent remaining battery, in the scene you see when you open SteamVR and do nothing and put your HMD on.
So apparently the variable can be retrieved somehow, question is where… I don’t see any bp nodes on this. I tried to read the source but I didn’t find anything useful as I’m not that good with C++.
However I did find this post via Google: Controller battery life / reported battery %age :: SteamVR Developer Hardware General Discussions
Though the Valve guy said it’s useless, it was after all almost a year ago. Things might’ve changed now.
And apparently he’s using Unity, cuz by googling “SteamVR.cs” I was led to “openvr/unity_package/Assets/SteamVR/Scripts/SteamVR.cs” on the OpenVR Github repo.
Then I noticed SteamVR’s api is OpenVR (not to be confused with OSVR) so I went back in to read the source and found this at line 1007 of openvr.h:
virtual float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
At line 191 there’s this “Prop_DeviceBatteryPercentage_Float” (the float that was mentioned in the steam community post). So as far as my understanding of cpp goes(which is probably a few milliemeters if not micrometers…) I should just include openvr.h in MotionControllerComponent and call this function and expose it to blueprint. But I really have no idea how to call this function… How do I get my vr::TrackedDeviceIndex_t for starters?
Has anyone tried anything similar? I’d really appreciate any help on this.
PS: I was thinking about making a flashlight and the light flickers when the actual controller’s battery is low.