void LateUpdate() //对摄像机的操作写在LateUpdate里
{
x += Input.GetAxis("Mouse X") * rotateSpeed * Time.deltaTime;
y -= Input.GetAxis("Mouse Y") * rotateSpeed * Time.deltaTime;
//根据人物位置确定摄像机的位置,这里用四元数进行了旋转
Quaternion camPosRotation = Quaternion.Euler(y, x, 0);
mTrans.position = camPosRotation * distanceVec + player.position;
mTrans.LookAt(player.position);
}
unity 鼠标控制摄像机围绕物体旋转
猜你喜欢
转载自blog.csdn.net/qwsx789/article/details/51190327
今日推荐
周排行