using UnityEngine;
using System.Collections;
public class FollowFarget : MonoBehaviour {
public Transform PlayerTransfrom;//定义一个公共组件,然后把主角拖到这个公共组件上,来获取主角的向量
private Vector3 Offset;
// Use this for initialization
void Start () {
Offset = transform.position - PlayerTransfrom.position;//两个向量相减
}
// Update is called once per frame
void Update () {
transform.position = PlayerTransfrom.position + Offset;//重新给相机的向量赋值
}
}