if (Input.GetAxis("Mouse ScrollWheel") > 0)
GetComponentInChildren<Camera>().fieldOfView--;
if (Input.GetAxis("Mouse ScrollWheel") < 0)
GetComponentInChildren<Camera>().fieldOfView--;
if (Input.GetAxis("Mouse ScrollWheel") < 0)
GetComponentInChildren<Camera>().fieldOfView++;
有问题的控制相机:
public class LookAtControl : MonoBehaviour {
public Transform Target;
// Update is called once per frame
void Update () {
transform.LookAt(Target);
float h = Input.GetAxis("Mouse X");
float v = Input.GetAxis("Mouse Y");
if( Input.GetMouseButton(1))
transform.localEulerAngles = Vector3.up * h * 50;
}
}