一、匀速运动
public Transform from;
public Transform to;
public float mMoveTime = 1f;
private float t = 0f;
void Update()
{
t += 1f / mMoveTime * Time.deltaTime;
from.position = Vector3.Lerp(from.position, to.position, t);
}
二、弹簧运动
public Transform from;
public Transform to;
public float mLerpRate = 15f;
private float t;
void Update()
{
t = mLerpRate * Time.deltaTime;
from.position = Vector3.Lerp(from.position, to.position, t);
}