unity里现实摄像头运镜并LookAt到物体前方 基于Dotween
1.基于Dotween 为了避免使用Update或循环带来的每帧多余消耗
2.这里控制的是主相机到一个物体的运镜
// plane.transform.GetChild(0)需要到达的物体
//得到俩个点的距离(可以根据俩个物体远近距离来计算运镜时间长短)
float lenth = (Camera.main.transform.parent.position - plane.transform.GetChild(0).position).magnitude;
//移动到相应位置
Camera.main.transform.parent.DOMove(plane.transform.GetChild(0).position + new Vector3(0, 2, 1), Mathf.Clamp(lenth / 1000f, 0.3f, 1.5f));
//LookAt看向相应位置
Camera.main.transform.parent.DOLookAt(plane.transform.GetChild(0).forward, Mathf.Clamp(lenth / 1000f, 0.3f, 1.5f));