/// <summary> /// Probe the TrackIR system to see if it's up. /// If we find that the system's state doesn't match our internal state, /// we'll call Connected or Disconnected. /// </summary> public void Probe() { try { _trackIR.TrackIR_Enhanced_Init(); _trackIR.client_HandleTrackIRData(); if (!_active) { _active = true; if (Connected != null) { Connected(); } } } catch (NullReferenceException) { // We'll get one of these if TrackIR is not connected if (_active) { _active = false; if (Disconnected != null) { Disconnected(); } } } }
public TrackIRTracker() { Debug.Log("[KerbTrack] Initialising TrackIR..."); trackIRclient = new TrackIRUnity.TrackIRClient(); string status; if (trackIRclient == null) status = "Failed to start."; else status = trackIRclient.TrackIR_Enhanced_Init(); Debug.Log("[KerbTrack] TrackIR status: " + status); }
public TrackIRTracker() { Debug.Log("[KerbTrack] Initialising TrackIR..."); // TrackIRUnity's init throws a NullRef if the DLL location isn't found. // Check this before starting. bool keyFound = false; RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", false); if (registryKey != null && registryKey.GetValue("Path") != null) { keyFound = true; } registryKey.Close(); string status; if (keyFound) { trackIRclient = new TrackIRUnity.TrackIRClient(); if (trackIRclient == null) { status = "Failed to start."; } else { status = trackIRclient.TrackIR_Enhanced_Init(); } } else { status = "TrackIR not installed"; } Debug.Log("[KerbTrack] TrackIR status: " + status); }