我不明白为什么Input.GetTouch
在这里不起作用。
private void Update()
{
Vector2 vel = rb.velocity;
float ang = Mathf.Atan2(vel.y, x: 10) * Mathf.Rad2Deg;
if (Input.GetKey(KeyCode.Space))
{
rb.AddForce(Vector2.up * gravity * Time.deltaTime * 2000f);
}
if (Input.GetTouch(TouchPhase.Began))
{
rb.AddForce(Vector2.up * gravity * Time.deltaTime * 2000f);
}
}
答案 0 :(得分:2)