Unity 6.3
0 онлайн 83 гостей 3 в системе
Вход

Vector2.Lerp

Declaration

public static Vector2 Lerp(Vector2 a, Vector2 b, float t);

Описание

Линейная интерполяция между векторами 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); } }