我刚刚开始使用 Unity,试图制作一个简单的 3D 平台游戏,在实现这一点之前,我需要降低运动速度。当玩家跳跃时我的问题就出现了。当他们跳跃时,他们可以在空中随心所欲地跳跃。我希望它只跳一次。有人可以帮忙吗?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Playermovement : MonoBehaviour
{
public Rigidbody rb;
void Start ()
}
void Update()
{
bool player_jump = Input.GetButtonDown("DefaultJump");
if (player_jump)
{
rb.AddForce(Vector3.up * 365f);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)