减慢玩家在空中的速度

Slow down player's speed in air

我目前正在开发一款基于 Unity 的 Roll-a-Ball 教程的 3D 游戏。我遇到的问题是,每当我的播放器跳跃时,它在空中的速度都会增加,我不希望这种情况发生。我试着想出一个解决方案,但我就是无法让它按照我想要的方式工作。我该如何防止这种情况发生?

如果有人感兴趣,这是我的代码:

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    private float movementX;
    private float movementY;
    public int count;
    public GameObject player;
    bool isGrounded = true;

    public TextMeshProUGUI countText;
    public GameObject winTextObject;

    public float speed = 0;
    public float jumpSpeed = 0;


    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();

        count = 0;

        SetCountText();

        winTextObject.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnMove(InputValue movementValue)
    {
        Vector2 movementVector = movementValue.Get<Vector2>();

        movementX = movementVector.x;
        movementY = movementVector.y;
    }

    void Jump()
    {
        if (Input.GetKey(KeyCode.Space) && isGrounded)
        {
            rb.AddForce(Vector2.up * jumpSpeed, ForceMode.Impulse);
        }
    }

    void FixedUpdate()
    {
        Jump();
        Vector3 movement = new Vector3(movementX, 0f, movementY);
        rb.AddForce(movement * speed);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("PickUp"))
        {
            other.gameObject.SetActive(false);
            count++;

            SetCountText();
        }
    }
    void SetCountText()
    {
        countText.text = "Score: " + count.ToString();

        if (count >= 14)
        {
            winTextObject.SetActive(true);
        }
    }

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isGrounded = true;
            Debug.Log("You are colliding with the ground!");
        }
    }

    private void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isGrounded = false;
            Debug.Log("You are no longer grounded!");
        }
    }
}

使用drag产生空气阻力: