控制相机的拖动旋转
float dx = Input.GetAxis("Mouse X");
float dy = Input.GetAxis("Mouse Y");
if (Input.GetMouseButton(0))
{
dx *= rotationSpeed;
dy *= rotationSpeed;
transform.Rotate(Vector3.right* dy* rotationSpeed * Time.fixedDeltaTime,Space.Self);//自身旋转
transform.Rotate(Vector3.up * dx* rotationSpeed * Time.fixedDeltaTime, Space.World);//世界旋转
}
//获取四元素
angles = transform.localEulerAngles;//0~360
if (angles.x < 180)
{
if (angles.x > 45)
{
transform.rotation = Quaternion.Euler(new Vector3(45, angles.y, angles.z));
}
}
if (angles.x > 180)
{
if (angles.x &l