public Transform target;
public float moveSmooth=5f;
Vector3 offset;
void Start () {
offset = transform.position - target.position;//获取相对位置
}
void Update () {
Vector3 targetPostion= offset + target.position;
transform.position = Vector3.Lerp(transform.position, targetPostion, moveSmooth*Time.deltaTime);
// transform.position = targetPostion;
}