在向量 a 与 b 之间按 t 进行线性插值。
参数 t 限制在范围 [0, 1] 内。
当 t = 0 时,返回 a 。
当 t = 1 时,返回 b 。
当 t = 0.5 时,返回 a 和 b 的中点。
另请参阅:LerpUnclamped。
using UnityEngine;
public class Example : MonoBehaviour { public Vector2 destination;
void Update() { //Moves the GameObject from it's current position to destination over time transform.position = Vector2.Lerp(transform.position, destination, Time.deltaTime); } }