IEnumerator Calibration() { while (!SensorHelper.gotFirstValue) { SensorHelper.FetchValue(); yield return(null); } // wait some frames yield return(new WaitForSeconds(0.1f)); // set initial rotation initialSensorValue = SensorHelper.rotation; // allow updates gotFirstValue = true; }
IEnumerator Calibration() { gotFirstValue = false; while (!SensorHelper.gotFirstValue) { SensorHelper.FetchValue(); yield return(null); } SensorHelper.FetchValue(); // wait some frames yield return(new WaitForSeconds(0.1f)); //// Initialize rotation values //Quaternion initialSensorRotation = SensorHelper.rotation; //initialCameraRotation *= Quaternion.Euler(0, -initialSensorRotation.eulerAngles.y, 0); //// allow updates gotFirstValue = true; }