先说较为简单的一种: 一、将摄像机作为人物角色的子对象,设置好相对距离和偏移量即可,但这种方法弊端较多,一般不采用。 二、 设置好摄像机跟物体的相对距离,之后利用插值让摄像机平滑跟随。 原理:摄像机与player以向量(有大小,有方向)相连,这样就可以确定摄像机与player的相对距离了,这样人物走动,摄像机也会跟随移动。 将下列代码与camera绑定就可以实现第三人称摄像机跟随。代码: public class CameraFollow : MonoBehaviour { // 摄像机跟随的对象 public Transform target; // The speed with which the camera will be following. public float smoothing = 5f; //偏移量 Vector3 offset; void Start() { //计算偏移量 offset = transform.position - target.position; } void LateUpdate () { Vector3 targetCamPos = target.position + offset; transform.position = Vector3.Lerp (transform.position, targetCamPos,