Version: 2017.3
public static Vector3 Lerp (Vector3 a, Vector3 b, float t);

설명

Linearly interpolates between two vectors.

Interpolates between the vectors a and b by the interpolant t. The parameter t is clamped to the range [0, 1]. This is most commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points).

When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform startMarker; public Transform endMarker; public float speed = 1.0F; private float startTime; private float journeyLength; void Start() { startTime = Time.time; journeyLength = Vector3.Distance(startMarker.position, endMarker.position); } void Update() { float distCovered = (Time.time - startTime) * speed; float fracJourney = distCovered / journeyLength; transform.position = Vector3.Lerp(startMarker.position, endMarker.position, fracJourney); } }

See Also: Slerp, LerpUnclamped.