unity3d 如何使用wasd移动物体?
首先给物体创建个脚本组件
然后加入下面代码即可
public int speed = 5;
public float H;
public float V;
void Start()
{
}
// Update is called once per frame
void Update()
{
H = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
V = Input.GetAxis("Vertical") * Time.deltaTime * speed;
this.gameObject.transform.Translate(H, 0, V);
}