以上只3 ~ 5 中間的數
(3 + 5) * 0.5 = 4
Vector3 from = new Vector3 (1f, 2f, 3f);
Vector3 to = new Vector3 (5f, 6f, 7f);
// Here result = (4, 5, 6)
Vector3 result = Vector3.Lerp (from, to, 0.75f);
向量轉換
int v = 1;
v = Mathf.Lerp(v, 10f, 0.5f); //每個影格分一半
以上放在Update
v 的數值會越來越接近10
變化約如下
Mathf.Lerp(5, 10f, 0.5f); // 5 ~ 10 的一半
Mathf.Lerp(7.75f 10f, 0.5f); // 5 ~ 10 的一半
Mathf.Lerp(8.75f 10f, 0.5f); // 5 ~ 10 的一半
Mathf.Lerp(9.75f 10f, 0.5f); // 5 ~ 10 的一半
Mathf.Lerp(10f 10f, 0.5f); // 5 ~ 10 的一半
Mathf.Lerp(1, 10f, 0.5f * Time.deltaTime);
每秒取一半的數值
沒有留言:
張貼留言