Пример #1
0
    void FixedUpdate()
    {
        Vector3 faVector = (transform.forward * Input.GetAxis("Vertical"));

        faVector += (transform.right * Input.GetAxis("Horizontal"));
        faVector += (transform.up * Input.GetAxis("Elevate"));

        if (faVector.magnitude != 0)
        {
            if (Input.GetButton("Dodge"))
            {
                bs.Dodge(faVector.normalized);
            }
        }

        Vector3 dx = (clampedMouse.x / rotRangeX) * bs.rotateSpeed * Mathf.Deg2Rad * transform.right;
        Vector3 dy = (clampedMouse.y / rotRangeY) * bs.rotateSpeed * Mathf.Deg2Rad * transform.up;
        Vector3 dz = -Input.GetAxis("Roll") * bs.rollSpeed * Mathf.Deg2Rad * transform.forward;

        bs.TorqueAssist(dx + dy + dz);

        if (flightAssistOn)
        {
            bs.FlightAssist(faVector.normalized * desiredMaxSpeed);
        }
        else
        {
            bs.Thrust(Input.GetAxis("Vertical"));
            bs.HorizThrust(Input.GetAxis("Horizontal"));
            bs.VertThrust(Input.GetAxis("Elevate"));
        }
    }