/// <summary> /// Update the static controller data once per frame. /// </summary> protected virtual void Update() { int ret = LibXHawkAPI.Update(m_JoyInfos); //Log.i("XHawkInput",ret.ToString()); if (ret == 0) { for (int i = 0; i < MAX_CONTROLLERS; ++i) { m_Controllers[i].Update(ref m_JoyInfos[i]); } } }
/// <summary> /// /// </summary> public override int Parse(byte[] buffer, int offset, int count) { // int i = 0; LibXHawkAPI.BytesToEuler(s_FloatsHelper, buffer, offset); rawEuler.Set(s_FloatsHelper[i++], s_FloatsHelper[i++], s_FloatsHelper[i++]); // m_Pose.rawEulerAngles = rawEuler; // //rawEuler=(Quaternion.Euler(rawEuler)*deviceRotation).eulerAngles; // rotation = runtimeRotation * Quaternion.Euler(rawEuler); eulerAngles = rotation.eulerAngles; // TODO --> // Just do it. m_Pose.rotation = rotation; m_Pose.DispatchEvent(VirtualPose.EVENT_UPDATE_ROTATION); return(IMU_BUFFER_SIZE); }
/// <summary> /// Initialize the X-Hawk and allocate the X-Cobra Controllers. /// </summary> protected virtual void Awake() { // int ret = LibXHawkAPI.Init(); m_JoyInfos = new LibXHawkAPI.joyinfo[2]; for (int i = 0; i < MAX_CONTROLLERS; ++i) { m_JoyInfos[i].Init(); m_Controllers[i] = new XCobraController(); m_Controllers[i].Awake(this); m_Controllers[i].HandBind = (XCobraHands)i; // Modify the hand type. } // if (ret != 0) { enabled = false; return; } }
/// <summary> /// Left XCobraController swap ble data with right XCobraController. /// </summary> public static void SwapBles() { LibXHawkAPI.SwapControllers(false, true); }
/// <summary> /// Left XCobraController swap blob data with right XCobraController. /// </summary> public static void SwapBlobs() { LibXHawkAPI.SwapControllers(true, false); }
// These functions will be deprecated in the future. // <!-- /// <summary> /// Left XCobraController swap data with right XCobraController. /// </summary> public static void SwapControllers() { LibXHawkAPI.SwapControllers(true, true); }
/// <summary> /// Exit X-Hawk library. /// </summary> protected virtual void OnDestroy() { LibXHawkAPI.Exit(); }