質問
オブジェクトを目標に移動させるための他のスクリプトとは何ですか?今私はVector3.Lerp
メソッドを使用しています。これは機能しますが、動いているゲームオブジェクトはそれが目標に到達する近くに遅くなります。私はこれを起こすのはこれをしないでください。それは遅くずっと目標に直接移動する必要があります。
ヘルプが高く評価されています。
解決
One approach is just to work out the direction it should head in and then move at a constant speed in that direction:
function Update() {
var dir = target - transform.position;
dir.Normalize();
transform.position += dir * speed * Time.deltaTime;
}
You'd have to make it a little more complicated than that so that it doesn't overshoot on the final frame, but this should give you a crude approximation of what you want.
他のヒント
You can use this function:
Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
It should do exactly what you want.
所属していません StackOverflow