bool IsTracked_Steam() { if (string.IsNullOrEmpty(context.Data.trackedByDevice)) { return(false); } try { if (trackedByIndexSteam.ToString() != context.Data.trackedByDevice) { trackedByIndexSteam = (SteamVR_TrackedObject.EIndex)System.Enum.Parse(typeof(SteamVR_TrackedObject.EIndex), context.Data.trackedByDevice); } if (trackedByIndexSteam == SteamVR_TrackedObject.EIndex.None || (int)trackedByIndexSteam >= Valve.VR.OpenVR.k_unMaxTrackedDeviceCount) { return(false); } if (!SteamVR.instance.hmd.IsTrackedDeviceConnected((uint)trackedByIndexSteam)) { return(false); } return(true); } catch (System.Exception) { return(false); } }
bool IsTracked_Steam() { if (string.IsNullOrEmpty(context.Data.trackedByDevice)) { return(false); } try { if (trackedByIndexSteam.ToString() != context.Data.trackedByDevice) { trackedByIndexSteam = (SteamVR_TrackedObject.EIndex)System.Enum.Parse(typeof(SteamVR_TrackedObject.EIndex), context.Data.trackedByDevice); } if (trackedByIndexSteam == SteamVR_TrackedObject.EIndex.None || (int)trackedByIndexSteam >= Valve.VR.OpenVR.k_unMaxTrackedDeviceCount) { return(false); } SteamVR_Controller.Device dev = SteamVR_Controller.Input((int)trackedByIndexSteam); return(dev.valid && dev.hasTracking); } catch (System.Exception) { return(false); } }