1. Translate
Translate (plusX, plusY, plusZ)
直接通過(guò)在當(dāng)前的x,y,z上加plusX, plusY, plusZ來(lái)移動(dòng)物體
如果希望使移動(dòng)不受幀率影響
Translate (plusX * Time.deltatime, plusY * Time.deltatime, plusZ * Time.deltatime)
2. MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta);
MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta);
Moves a point current in a straight line towards a target point.
3. Lerp
Vector3.Lerp (Vector3 a, Vector3 b, float t);
https://docs.unity3d.com/ScriptReference/Vector3.Lerp.html
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).
按百分比移動(dòng)姐叁,可用于實(shí)現(xiàn)物體的速度漸減/漸增移動(dòng)
4. 給rigidbody一個(gè)速度
rb.velocity =