Last active
September 11, 2018 16:30
-
-
Save robinnorth/613c47cd516eb83d15f8efcbd01ded51 to your computer and use it in GitHub Desktop.
Detect Vive/Oculus usage with SteamVR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://steamcommunity.com/app/358720/discussions/0/343787283754448603/?ctp=2#c1326718197205185044 | |
bool BIsHTCViveController() | |
{ | |
System.Text.StringBuilder sbType = new System.Text.StringBuilder(1000); | |
Valve.VR.ETrackedPropertyError err = Valve.VR.ETrackedPropertyError.TrackedProp_Success; | |
SteamVR.instance.hmd.GetStringTrackedDeviceProperty((uint)trackedObj.index, Valve.VR.ETrackedDeviceProperty.Prop_ManufacturerName_String, sbType, 1000, ref err); | |
return ( err == Valve.VR.ETrackedPropertyError.TrackedProp_Success && sbType.ToString().StartsWith("HTC") ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment