相机控制【Low版】

版权声明:本博客所上传的任意博客都归本人所有,本人拥有最终解释权 https://blog.csdn.net/qq_34199256/article/details/80472832
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;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_34199256/article/details/80472832