private void Move()
{
float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
//if (h != 0 && v != 0)
//{
// return;
//}
if (Mathf.Abs(h) > 0)
{
v = 0;
}
if (Mathf.Abs(v) > 0)
{
h = 0;
}
transform.Translate(Vector3.right * h * moveSpeed * Time.deltaTime);
transform.Translate(Vector3.up * v * moveSpeed * Time.deltaTime);
}
初学者,纠结好几天了。
{
float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
//if (h != 0 && v != 0)
//{
// return;
//}
if (Mathf.Abs(h) > 0)
{
v = 0;
}
if (Mathf.Abs(v) > 0)
{
h = 0;
}
transform.Translate(Vector3.right * h * moveSpeed * Time.deltaTime);
transform.Translate(Vector3.up * v * moveSpeed * Time.deltaTime);
}
初学者,纠结好几天了。