using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 控制摄像机随鼠标旋转
///
public class DoRotation : MonoBehaviour
{
public float rotateSpeed = 1;
private void FixedUpdate()
{
float x = Input.GetAxis("Mouse X");
float y = Input.GetAxis("Mouse Y");
if (x!=0||y!=0)
RotateView(x, y);
}
private void RotateView(float x, float y)
{
x *= rotateSpeed;
y *= rotateSpeed;
this.transform.Rotate(0, x, 0, Space.World);//左右旋转按照世界坐标
//this.transform.Rotate(-y, 0, 0, Space.Self);//上下旋转按自身坐标
}
}