public class xuanzhuan : MonoBehaviour { //平移速度变量 public float MoveSpeed;// Use this for initialization void Start () { } // Update is called once per frame void Update () {//键盘判断 if(Input.GetKey(KeyCode.A)){ transform.Translate(Vector3.left* MoveSpeed,Space.World); } if(Input.GetKey(KeyCode.D)){ transform.Translate(Vector3.right* MoveSpeed,Space.World); } if(Input.GetKey(KeyCode.W)){ transform.Translate(Vector3.up* MoveSpeed,Space.World); } if(Input.GetKey(KeyCode.S)){ transform.Translate(Vector3.down* MoveSpeed,Space.World); } //鼠标判断 if(Input.GetMouseButton(0)){ transform.Rotate(Vector3.down* MoveSpeed,Space.World); } //鼠标判断 if(Input.GetMouseButton(1)){ transform.Rotate(Vector3.up* MoveSpeed,Space.World); } //滚轮放大缩小 //Zoom out if (Input.GetAxis("Mouse ScrollWheel") <0) { if(Camera.main.fieldOfView<=100) Camera.main.fieldOfView +=2; if(Camera.main.orthographicSize<=20) Camera.main.orthographicSize +=0.5F; } //Zoom in if (Input.GetAxis("Mouse ScrollWheel") > 0) { if(Camera.main.fieldOfView>2) Camera.main.fieldOfView-=2; if(Camera.main.orthographicSize>=1) Camera.main.orthographicSize-=0.5F; } }}