Answer the question
In order to leave comments, you need to log in
How to move around given points in unity3d?
How can you move to given points? I have an array of different points on the map and the AI speed is set, it is necessary that it runs from the first to the second point, then to the third and so on. How can this be done? I found an implementation for this idea, but more smooth, I would like it not to be superfluous and just have a sharp 90-degree turn, etc., if he has to turn
Answer the question
In order to leave comments, you need to log in
There is such a DOTween asset - https://assetstore.unity.com/packages/tools/animat...
List<Vector3> points; // список точек
Transform t; // двигающийся объект
float speed = 5f;
var seq = DOTween.Sequence();
foreach (var p in points)
{
seq.Append(t.DOLookAt(p), 1f); // поворачиваем на точку
seq.Append(t.DOMove(p, speed)); // двигаем в точку
seq.SetLoops(-1, LoopType.Yoyo); // двигаемся без конца
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question