Esempio n. 1
0
    void Update()
    {
        Rigidbody rigidbody = flightController.GetComponent <Rigidbody>();

        float fAltitude         = rigidbody.position.y;
        float fVelocity         = rigidbody.velocity.magnitude;
        float fVerticalVelocity = rigidbody.velocity.y;
        float fCompassDir       = rigidbody.rotation.eulerAngles.y;

        // Altitude
        objAltShortHand.transform.localEulerAngles = new Vector3(0.0f, 0.0f, -fAltitude / fAltShortHandAmount * 36.0f);
        objAltLongHand.transform.localEulerAngles  = new Vector3(0.0f, 0.0f, -fAltitude / fAltLongHandAmount * 36.0f);

        // Attitude
        objAttBall.transform.eulerAngles = new Vector3(fAdjustXRot, 0.0f, 0.0f);

        // Compass
        objCompassDir.transform.localEulerAngles = new Vector3(0.0f, 0.0f, fCompassDir);

        // Speed
        objWindSpeedHand.transform.localEulerAngles     = new Vector3(0.0f, 0.0f, 90.0f - fVelocity * 51.4285714f);
        objVerticalSpeedHand.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 90.0f - fVerticalVelocity * 40.0f);
    }