Run an iTween path backwards?

Hi All,

A simple yes or no, followed by any ideas on how would be great for this one. I've been wracking my brain trying to work out a method of animating backwards along a path using MoveTo from the iTween set. Is it even possible? And then secondly, how would you run that path from the present location. Like hitting rewind on a tape?

I was considering using a reverse array command in there somewhere, but then that wouldn't let me pick up where my present location was.

Cheers, Daniel

use pingPong as a loop type

I'm working on something similar though simpler. Are you using the iTweenPath class? if so, are you calling iTween by hand as in iTween.MoveTo(object, iTweenPath.GetPath(myPathName), or how are you doing this? in a nutshell, you'll need to add an option to revert the path, call iTween.StopByName, and then run along a new path with a partial subset of your path.

1 Answer

1

Hi Daniel.
Had the same problem recently and the solution is quite easy (this worked in my case hope it’ll help u too):

Let’s say this is the way to go from A to B :

iTween.MoveTo(gameObject, iTween.Hash(“path”, iTweenPath.GetPath(“Path1”), “time”, 5, “easetype”, iTween.EaseType.linear));

The code that will move your object from B to A would be :

iTween.MoveTo(gameObject, iTween.Hash(“path”, iTweenPath.GetPathReversed(“Path1”), “time”, 5, “easetype”, iTween.EaseType.linear));

Cheers Paul S.

Looks like I have a outdated version as GetPathReversed did not work :) Grabbed the latest and it works great :)

glad to hear that :)