Пример #1
0
        public void UpdateEngine(Rigidbody rigidbody, F450Inputs input)
        {
            /* Opposite force:
             *  You can add to engineForce a force opposite to the gravity;this makes flying the UAV a bit easier.
             *  F = -Fg = rigidbody.mass * Physics.gravity.magnitude
             */
            float engineForce = input.Throttle * _maxPower / 4f;

            _finalEngineForce = Mathf.Lerp(_finalEngineForce, engineForce, Time.deltaTime * _lerpSpeed);

            rigidbody.AddForce(transform.up * _finalEngineForce, ForceMode.Force);

            HandlePropeller();
        }
 void Start()
 {
     _input   = GetComponent <F450Inputs>();
     _engines = GetComponentsInChildren <IEngine>().ToList <IEngine>();
 }