Unity里WASD移动时两键同时按,不能同时相应。求解决方法!!
varspeed:float=7;vartransspeed:float=5;functionStart(){}functionUpdate(){if(Input.Get...
var speed:float =7;
var transspeed:float =5;
function Start ()
{
}
function Update ()
{
if (Input.GetKey(KeyCode.W))
{
this.transform.Translate(Vector3.forward *Time.deltaTime * speed);
}
else if (Input.GetKey(KeyCode.A))
{
this.transform.Translate(Vector3.right *Time.deltaTime* -transspeed);
}
else if (Input.GetKey(KeyCode.D))
{
this.transform.Translate(Vector3.right *Time.deltaTime *transspeed);
}
else if (Input.GetKey(KeyCode.S))
{
this.transform.Translate(Vector3.forward *Time.deltaTime * -speed);
}
} 展开
var transspeed:float =5;
function Start ()
{
}
function Update ()
{
if (Input.GetKey(KeyCode.W))
{
this.transform.Translate(Vector3.forward *Time.deltaTime * speed);
}
else if (Input.GetKey(KeyCode.A))
{
this.transform.Translate(Vector3.right *Time.deltaTime* -transspeed);
}
else if (Input.GetKey(KeyCode.D))
{
this.transform.Translate(Vector3.right *Time.deltaTime *transspeed);
}
else if (Input.GetKey(KeyCode.S))
{
this.transform.Translate(Vector3.forward *Time.deltaTime * -speed);
}
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询