Пример #1
0
        /// <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]);
                }
            }
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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;
            }
        }
Пример #4
0
 /// <summary>
 /// Left XCobraController swap ble data with right XCobraController.
 /// </summary>
 public static void SwapBles()
 {
     LibXHawkAPI.SwapControllers(false, true);
 }
Пример #5
0
 /// <summary>
 ///  Left XCobraController swap blob data with right XCobraController.
 /// </summary>
 public static void SwapBlobs()
 {
     LibXHawkAPI.SwapControllers(true, false);
 }
Пример #6
0
        // 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);
        }
Пример #7
0
 /// <summary>
 /// Exit X-Hawk library.
 /// </summary>
 protected virtual void OnDestroy()
 {
     LibXHawkAPI.Exit();
 }