void LateUpdate() { if (resetFlag) { ResetOrientation(); resetFlag = false; } CheckSetPose(); if (Input.GetButtonDown("Menu")) // if ( Input.GetKeyDown ( KeyCode.Escape ) ) { UnityMainThreadDispatcher.Cleanup(); UnityEngine.SceneManagement.SceneManager.LoadScene("proto4"); // #if !UNITY_EDITOR // ROSController.StopROS ( new System.Action ( () => { Application.Quit (); } ) ); // #endif } KeyCode leftCtrl = Application.platform == RuntimePlatform.OSXPlayer ? KeyCode.LeftCommand : KeyCode.LeftControl; KeyCode rightCtrl = Application.platform == RuntimePlatform.OSXPlayer ? KeyCode.RightCommand : KeyCode.RightControl; if (Input.GetButtonDown("Quit") && (Input.GetKey(leftCtrl) || Input.GetKeyDown(rightCtrl))) // if ( Input.GetKeyDown ( KeyCode.Q ) && ( Input.GetKey ( KeyCode.LeftControl ) || Input.GetKey ( KeyCode.RightControl ) ) ) { Application.Quit(); } if (Input.GetButtonDown("Legend")) // f10 now // if ( Input.GetKeyDown ( KeyCode.L ) ) { showLegend = !showLegend; } // use this to have a follow camera rotate with the quad. not proper torque! if (rotateWithTorque) { float zAngle = 0; Vector3 up = transform.up; if (up.y >= 0) { zAngle = transform.localEulerAngles.z; } else { zAngle = -transform.localEulerAngles.z; } while (zAngle > 180) { zAngle -= 360; } while (zAngle < -360) { zAngle += 360; } transform.Rotate(Vector3.up * -zAngle * Time.deltaTime, Space.World); } // spin rotors if we need if (spinRotors) { float rps = maxRotorRPM / 60f; float degPerSec = rps * 360f; curRotorSpeed = degPerSec; // if ( inputCtrl.active ) // { // curRotorSpeed = degPerSec; // } else // { // if ( useTwist ) // { // curRotorSpeed = Mathf.InverseLerp ( Physics.gravity.y, -Physics.gravity.y, rb.velocity.y ) * degPerSec; // // curRotorSpeed = 0.5f * degPerSec * ( rb.velocity.y + Physics.gravity.y ) / -Physics.gravity.y / rb.mass; // } else // { // curRotorSpeed = 0.5f * degPerSec * force.y / -Physics.gravity.y / rb.mass; // } // // } // use forward for now because rotors are rotated -90 Vector3 rot = Vector3.forward * curRotorSpeed * Time.deltaTime; frontLeftRotor.Rotate(rot); frontRightRotor.Rotate(-rot); rearLeftRotor.Rotate(-rot); rearRightRotor.Rotate(rot); } if (Input.GetButtonDown("Quality")) // if ( Input.GetKeyDown ( KeyCode.F5 ) ) { int level = QualitySettings.GetQualityLevel(); level = ++level % 3; QualitySettings.SetQualityLevel(level, true); } }