Interface into the Gyroscope.

    static void Gyroscope_gravity(JSVCall vc)
    {
        UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
        var result = _this.gravity;

        JSApi.setVector3S((int)JSApi.SetType.Rval, result);
    }
    static void Gyroscope_userAcceleration(JSVCall vc)
    {
        UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
        var result = _this.userAcceleration;

        JSApi.setVector3S((int)JSApi.SetType.Rval, result);
    }
 static public int set_updateInterval(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.updateInterval = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    static void Gyroscope_rotationRateUnbiased(JSVCall vc)
    {
        UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
        var result = _this.rotationRateUnbiased;

        JSApi.setVector3S((int)JSApi.SetType.Rval, result);
    }
 static public int get_rotationRateUnbiased(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.rotationRateUnbiased);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    static void Gyroscope_attitude(JSVCall vc)
    {
        UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
        var result = _this.attitude;

        JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
    }
Exemple #7
0
 void EnableGyro()
 {
     if (SystemInfo.supportsGyroscope)
     {
         gyro         = Input.gyro;
         gyro.enabled = true;
     }
 }
Exemple #8
0
 // Start is called before the first frame update
 void Start()
 {
     gyro = Input.gyro;
     if (!gyro.enabled)
     {
         gyro.enabled = true;
     }
 }
Exemple #9
0
    static public int set_updateInterval(IntPtr l)
    {
        UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.updateInterval = v;
        return(0);
    }
Exemple #10
0
    static public int set_enabled(IntPtr l)
    {
        UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.enabled = v;
        return(0);
    }
        public static void CreateTracker()
        {
            #if !UNITY_2019_1_OR_NEWER || ENABLE_LEGACY_INPUT_MANAGER
            Input.gyro.enabled = true;
            gyro = Input.gyro;
            #endif

            _headTracker = CardboardHeadTracker_create();
            Init();
        }
Exemple #12
0
 private bool EnableGyro()
 {
     if (SystemInfo.supportsGyroscope)
     {
         gyro         = Input.gyro;
         gyro.enabled = true;
         return(true);
     }
     return(false);
 }
Exemple #13
0
 static public int get_enabled(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         pushValue(l, self.enabled);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int get_enabled(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.enabled);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #15
0
 public void EnableGyro()
 {
     if (gyroPresent)
     {
         return;
     }
     if (SystemInfo.supportsGyroscope)
     {
         gyro         = Input.gyro;
         gyro.enabled = true;
     }
     gyroPresent = gyro.enabled;
 }
 static public int set_enabled(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.enabled = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_updateInterval(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.updateInterval = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #18
0
 static public int set_updateInterval(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.updateInterval = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #19
0
 static public int set_enabled(IntPtr l)
 {
     try {
         UnityEngine.Gyroscope self = (UnityEngine.Gyroscope)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.enabled = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static void Gyroscope_updateInterval(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
         var result = _this.updateInterval;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single         arg0  = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
         _this.updateInterval = arg0;
     }
 }
 static void Gyroscope_enabled(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
         var result = _this.enabled;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean        arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.Gyroscope _this = (UnityEngine.Gyroscope)vc.csObj;
         _this.enabled = arg0;
     }
 }
Exemple #22
0
    void Start()
    {
        gyroSupport = SystemInfo.supportsGyroscope;

        if (gyroSupport)
        {
            UnityEngine.Gyroscope gyro = Input.gyro;
            gyroEnabled  = true;
            gyro.enabled = true;
        }
        else
        {
            gyroEnabled = false;
            print("NO GYRO");
        }

        ApplyCalibration();
    }
        // Update is called once per frame
        private void Update()
        {
            RotateView();
            //Debug.Log("Update time :" + Time.deltaTime);
            // the jump state needs to read here to make sure it is not missed // comment by aaron, yes, quite right, I missed when putting it in FixedUpdate
            if (!m_Jump)
            {
                vr_Gyro = Input.gyro;
                vr_GyroAccYAxis = vr_Gyro.userAcceleration.y;
                if (vr_GyroAccYAxis > 2 && vr_GyroAccYAxis <= 3) {
                    print ("jump in update over 2 acc is" + vr_GyroAccYAxis);
                } else if (vr_GyroAccYAxis >= 1 && vr_GyroAccYAxis <= 2) {
                    print ("jump in update over 1 acc is" + vr_GyroAccYAxis);
                    m_Jump = true;
                } else if (vr_GyroAccYAxis >= 0.1 && vr_GyroAccYAxis < 1) {
                    print ("jump in update over 0.1 acc is" + vr_GyroAccYAxis);
                    m_Jump = false;
                } else if (vr_GyroAccYAxis >= 0.08 && vr_GyroAccYAxis < 0.1) {
                    print ("jump in update over 0.08 acc is" + vr_GyroAccYAxis);
                    m_Jump = false;
                } else if (vr_GyroAccYAxis >= 0.05 && vr_GyroAccYAxis < 0.08) {
                    print ("jump in update over 0.05 acc is" + vr_GyroAccYAxis);
                    m_Jump = false;
                } else if (vr_GyroAccYAxis >= 0.02 && vr_GyroAccYAxis < 0.05) {
                    print ("jump in update over 0.02 acc is" + vr_GyroAccYAxis);
                    m_Jump = false;
                } else if (vr_GyroAccYAxis > 0 && vr_GyroAccYAxis < 0.02) {
                    print ("jump in update over 0, acc is" + vr_GyroAccYAxis);
                    m_Jump = false;
                }
            }

            #if !MOBILE_INPUT
            if (!m_Jump)
            {
                m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
            }
            #endif

            if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
            {
                StartCoroutine(m_JumpBob.DoBobCycle());
                PlayLandingSound();
                m_MoveDir.y = 0f;
                m_Jumping = false;
            }
            if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
            {
                m_MoveDir.y = 0f;
            }

            m_PreviouslyGrounded = m_CharacterController.isGrounded;
        }
Exemple #24
0
 static public int get_gravity(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.gravity);
     return(1);
 }
Exemple #25
0
 static public int get_userAcceleration(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.userAcceleration);
     return(1);
 }
Exemple #26
0
 static public int get_attitude(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.attitude);
     return(1);
 }
Exemple #27
0
 static public int get_enabled(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.enabled);
     return(1);
 }
        /// <summary>
        /// Called while objects are being initialised.
        /// </summary>
        void Awake()
        {
            // Cache variables
            m_trans = transform;
            m_rb2D = GetComponent<Rigidbody2D>();
            m_gameManager = GameObject.FindObjectOfType<GameManager>();
            m_sceneCamTrans = sceneCam.transform;

            if (SystemInfo.supportsGyroscope)
            {
                // Enable and configure the gyro if supported
                m_gyro = Input.gyro;
                m_gyro.enabled = true;

                Input.compensateSensors = true;

                // Set initial device rotation value
                m_deviceRot = m_gyro.attitude;
            }
        }
Exemple #29
0
 static public int get_updateInterval(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.updateInterval);
     return(1);
 }
Exemple #30
0
 static public int get_rotationRateUnbiased(IntPtr l)
 {
     UnityEngine.Gyroscope o = (UnityEngine.Gyroscope)checkSelf(l);
     pushValue(l, o.rotationRateUnbiased);
     return(1);
 }