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;
}

posted on 2016-04-27 11:50  独蠢无双  阅读(4916)  评论(0编辑  收藏  举报