Vector3
- Angle
- ClampMagnitude
- Cross
- Distance
- Dot
- forward
- Lerp
- magnitude
- Max
- Min
- MoveTowards
- normalized
- Normalize
- one
- operator !=
- operator *
- operator +
- operator -
- operator /
- operator ==
- OrthoNormalize
- Project
- Reflect
- right
- RotateTowards
- Scale
- Slerp
- SmoothDamp
- sqrMagnitude
- this [int index]
- ToString
- up
- Vector3
- x
- y
- zero
- z
Vector3.Lerp 插值
static function Lerp (from : Vector3, to : Vector3, t : float) : Vector3
Description描述
Linearly interpolates between two vectors.
两个向量之间的线性插值。
Interpolates from towards to by amount t.
按照数字t在from到to之间插值。
t is clamped between [0...1]. When t = 0 returns from. When t = 1 returns to. When t = 0.5 returns the average of from and to.
t是夹在 [0...1]之间,当t = 0时,返回from,当t = 1时,返回to。当t = 0.5 返回from和to的平均数。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform start;
public Transform end;
void Update() {
transform.position = Vector3.Lerp(start.position, end.position, Time.time);
}
}
另一个例子:
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform target;
public float smooth = 5.0F;
void Update() {
transform.position = Vector3.Lerp(transform.position, target.position, Time.deltaTime * smooth);
}
}
// Follows the target position like with a spring
//像弹簧一个跟随目标物体
var target : Transform;
var smooth = 5.0;
function Update () {
transform.position = Vector3.Lerp (
transform.position, target.position,
Time.deltaTime * smooth);
}
最后修改:2010年12月19日 Sunday 22:52