using UnityEngine;
using System.Collections;
/// <summary>
/// 錄影機的跟随
/// </summary>
public class Follow : MonoBehaviour {
//目标
public Transform target;
//向後的距離
public float backDistance = ;
//高度
public float topDistance = ;
//俯角
public float lookDgree = f;
void Start () {
}
//總是晚于Update,适合做跟随效果
void LateUpdate () {
//計算目标的自身坐标系正後方位置
Vector3 end = -target.forward * backDistance + target.up * topDistance;
transform.position = target.position + end;
//計算旋轉,保持跟目标一樣
transform.rotation = target.rotation * Quaternion.Euler(lookDgree, , );
}
}