前景提要
常用于摄像机追随玩家 实现平滑跟踪
void Update () {
if (player != null) {
float x = Mathf.Lerp (this.transform.position.x , player.position.x , 0.2f);
float y = Mathf.Lerp (this.transform.position.y , player.position.y , 0.2f);
this.transform.position = new Vector3 (x , y , this.transform.position.z);
}
}