void Update() { float h=Input.GetAxis("Horizontal")*speed*Time.deltaTime; float v=Input.GetAxis("Vertical")*speed*Time.deltaTime; transform.Translate(h,0,v);//或者可以分开写
//transform.Translate(Vector3.right*h);
//transform.Translate(Vector3.forward*v);
}
speed is the step size, the step size is multiplied by the time distance of each frame is
deltaTime is this frame to the next rendering pass the time.