Skip to content

Instantly share code, notes, and snippets.

@robinnorth
Last active September 11, 2018 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinnorth/613c47cd516eb83d15f8efcbd01ded51 to your computer and use it in GitHub Desktop.
Save robinnorth/613c47cd516eb83d15f8efcbd01ded51 to your computer and use it in GitHub Desktop.
Detect Vive/Oculus usage with SteamVR
// 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