public void Poll() { try { TrackIRClient.LPTRACKIRDATA state; state = _trackIR.client_HandleTrackIRData(); if (TrackIRWrapper.IsChanged(_trackIRState, state)) { if (UpdateHandler != null) { UpdateHandler(state); } } } catch (NullReferenceException) { // We'll get one of these if TrackIR is not connected if (_active) { _active = false; if (Disconnected != null) { Disconnected(); } } } }
public void GetData(ref Vector3 rot, ref Vector3 pos) { if (trackIRclient != null) { TrackIRClient.LPTRACKIRDATA data = trackIRclient.client_HandleTrackIRData(); rot.x = -data.fNPPitch / 100; rot.y = data.fNPYaw / 100; rot.z = data.fNPRoll / 100; pos.x = -data.fNPX / 10000; pos.y = data.fNPY / 10000; pos.z = data.fNPZ / 10000; } }