1、摄像机向下移动
// camPosition.x = mainCamera.transform.position.x;
// camPosition.z = mainCamera.transform.position.z;
// camPosition.y -= 40f * Time.deltaTime;
// mainCamera.transform.position = camPosition;
2、
float camAngle;
Vector3 vector;
mainCamera.transform.rotation.ToAngleAxis(out camAngle, out vector);
3、获取欧拉角
vector = shiyeObj.transform.rotation.eulerAngles;
4、直接设置位置与角度
//mainCamera.transform.position = new Vector3(2.408182f, 5.54615f, -6.8f);
//mainCamera.transform.rotation = Quaternion.Euler(new Vector3(22.01f, 22.206f, 0.65f));
5、把一个物体向量转为另一个物体方向
mainCamera.transform.rotation = Quaternion.Slerp(mainCamera.transform.rotation, Quaternion.LookRotation(-dirR), Time.deltaTime * 10);
6、任一轴旋转
Vector3 cameraDir = new Vector3(0, 0, mainCamera.transform.position.y);
Vector3 syDir = mainCamera.transform.position - shiyeObj.transform.position;
Vector3 dir = Vector3.Cross(syDir, cameraDir);
float angle1 = Vector3.Dot(Camera.mainCamera.transform.position, syObj.transform.position);
mainCamera.transform.rotation *= Quaternion.AngleAxis(angle1, dir);
7、float indexAngle = Vector3.AngleBetween( Camera.mainCamera.transform.position,shiyeObj.transform.position );
8、 mainCamera.transform.rotation *= Quaternion.AngleAxis(15f * Time.deltaTime, new Vector3(0f, 6.436983f, 0f));
9、旋转
//if (angle < 320)
//{
// mainCamera.transform.RotateAround(firstCameraPos, Vector3.up, -20 * Time.deltaTime);
//}
//else
//{
//curSceType = curSceneType.Scene_RotationFinish;
//}