Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DoTween DoPath's speed between waypoints

I have a question about DoPath's speeds between waypoints. I want constant speed from start to end but i couldn't achieve that. But speed changing between waypoints.

I couln't find solution for my problem.

Vector3 firstPoint = from+new Vector3(5f,5f,0);

pathList.Add(from);
pathList.Add(firstPoint);
pathList.Add(to);


Vector3[] pathArr = pathList.ToArray();

GameObject trail = Instantiate(config.fireWork, from, Quaternion.identity);
       trail.transform.DOPath(pathArr,3,PathType.CatmullRom,PathMode.TopDown2D).SetEase(Ease.Linear).SetLookAt(0.01f).SetDelay(1f);

https://gfycat.com/highunknowngentoopenguin

I want constant speed from start to end.

like image 949
ilyas kose Avatar asked Nov 02 '25 17:11

ilyas kose


2 Answers

Looks like it only takes in the duration of the tween.

You may have to use the generic way: DOTween.To(...).

Get the distance between the current points and divide it by your movement speed.

like image 136
Iggy Avatar answered Nov 05 '25 15:11

Iggy


If you put .SetSpeedBased(true) the duration will represent the number of units the tween moves x second.

P.S. You can also set .SetLoops(-1) execution will loop on path.

like image 38
T M Avatar answered Nov 05 '25 16:11

T M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!