Пример #1
0
        void Update()
        {
            // Touch screen to recalibrate.
            for (int i = 0; i < Input.touchCount; i++)
            {
                if (Input.GetTouch(i).phase == TouchPhase.Began)
                {
                    UnityGyroAxisSource.Calibrate();
                }
            }

            // Use last device which provided input.
            var inputDevice = InputManager.ActiveDevice;

            // Rotate target object with gyroscope mapped to left stick.
            transform.Rotate(Vector3.down, 500.0f * Time.deltaTime * inputDevice.LeftStickX, Space.World);
            transform.Rotate(Vector3.right, 500.0f * Time.deltaTime * inputDevice.LeftStickY, Space.World);
        }
Пример #2
0
        IEnumerator CalibrateGyro()
        {
            yield return(new WaitForSeconds(0.1f));

            UnityGyroAxisSource.Calibrate();
        }