标签:
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;
}
标签:
原文地址:http://www.cnblogs.com/wangweixznu/p/5438324.html