通过 t 线性插值向量 a 和 b 之间。
参数 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); } }