Search code examples
c#unity-game-engineitween

Constant speed issue in defining iTween path


I've designed a curved path like the below figure. enter image description here

The cube move along the path from the left side to the right side of scene by this line of code:

iTween.MoveTo(gameObject,iTween.Hash("oncomplete","destroying","orienttopath", true, "path",path,"time",1.6,"easetype",iTween.EaseType.linear,"movetopath",false));

the EaseType parameter is was selected linear and I expect to path the path with a constant velocity, however the speed is reduced when the cube is in the curved path (left side before the midpoint) and then in a straight path it accelerates and catches it up.

I would like to know how can I define a constant speed for entire path.

Thanks


Solution

  • iTween will take the same time going from node 1 to node 2 as it will going from node 2 to node 3. Since your first 2 nodes are close together it will go slowly here and speed up towards the third.

    If you get a more uniform distance between your nodes you'll experience a smoother path using linear easetype