예제 #1
0
        private void LiftProcess(HelicopterModel Model)
        {
            var upForce = 1 - Mathf.Clamp(Model.transform.position.y / Model.EffectiveHeight, 0, 1);

            upForce = Mathf.Lerp(0f, Model.EngineForce, upForce) * Model.Helicopter.mass;
            Model.Helicopter.AddRelativeForce(Vector3.up * upForce);
        }
예제 #2
0
        private void MoveProcess(HelicopterModel Model)
        {
            var turn = Model.TurnForce * Mathf.Lerp(Input.Move.x, Input.Move.x * (Model.turnTiltForcePercent - Mathf.Abs(Input.Move.y)), Mathf.Max(0f, Input.Move.y));

            hTurn = Mathf.Lerp(hTurn, turn, Time.fixedDeltaTime * Model.TurnForce);
            Model.Helicopter.AddRelativeTorque(0f, hTurn * Model.Helicopter.mass, 0f);
            Model.Helicopter.AddRelativeForce(Vector3.forward * Mathf.Max(0f, Input.Move.y * Model.ForwardForce * Model.Helicopter.mass));
        }
예제 #3
0
        private void Processing(HelicopterModel Model)
        {
            if (Input.UpMove > 0)
            {
                Model.EngineForce += 0.1f;
            }
            else
            if (Input.UpMove < 0)
            {
                Model.EngineForce -= 0.12f;
            }

            LiftProcess(Model);

            if (Model.IsOnGround)
            {
                return;
            }

            MoveProcess(Model);
            TiltProcess(Model);
        }
예제 #4
0
 private void TiltProcess(HelicopterModel Model)
 {
     hTilt.x = Mathf.Lerp(hTilt.x, Input.Move.x * Model.TurnTiltForce, Time.deltaTime);
     hTilt.y = Mathf.Lerp(hTilt.y, Input.Move.y * Model.ForwardTiltForce, Time.deltaTime);
     Model.transform.localRotation = Quaternion.Euler(hTilt.y, Model.transform.localEulerAngles.y, -hTilt.x);
 }