限制Camera区域在限制边缘不会卡顿

限制Camera区域在限制边缘不会卡顿

public class ArcherController : MonoBehaviour
{
	public GameObject gyr;
	// Use th  is for initialization
	void Start ()
	{
		tmp = gyroscopeRotation;
		Application.targetFrameRate = 60;
	}

	private Vector3 gyroscopeRotation;
	private Vector3 tmp;
	// Update is called once per frame
	void Update ()
	{
		gyroscopeRotation = gyr.transform.rotation.eulerAngles;
		this.transform.eulerAngles = new Vector3 (gyroscopeRotation.x, this.transform.eulerAngles.y + (gyroscopeRotation - tmp).y, gyroscopeRotation.z);
		tmp = gyroscopeRotation;
		this.transform.eulerAngles = new Vector3 (this.transform.eulerAngles.x, Mathf.Clamp (this.transform.eulerAngles.y, 40, 150), this.transform.eulerAngles.z);

	}
}


猜你喜欢

转载自blog.csdn.net/u014732824/article/details/78819028