- Home /
iTween PutOnPath
I try to use iTween PutOnPath to move object along path with control of position. I' dont understand what's the right code syntax for this command in javascript.
...
iTween.PutOnPath(this.gameObject, iTween.Hash("path", iTweenPath.GetPath("Gamba1")) ...
...
Somebody help me?
Answer by dorpeleg · Feb 17, 2013 at 08:54 PM
iTween.PutOnPath(this.gameObject, iTween.Hash("path", iTweenPath.GetPath("Gamba1")), 50)
This will put your gameobject half way trough the path.
The number is a percentage of the path (0 is start of path and 100 is end) and its a float type.
I try. give me error:
Assets/Libreria/Script/$$anonymous$$ovePathS.js(20,17): BCE0023: No appropriate version of 'iTween.PutOnPath' for the argument list '(UnityEngine.GameObject, System.Collections.Hashtable, float)' was found.
iTween.PutOnPath(this.gameObject, iTween.Hash("path", iTweenPath.GetPath("Gamba1"), 50))
Try this, I think I made s little mistake :)
I has try.. Same type of Error: Assets/Libreria/Script/$$anonymous$$ovePathS.js(69,17): BCE0023: No appropriate version of 'iTween.PutOnPath' for the argument list '(UnityEngine.GameObject, System.Collections.Hashtable)' was found. Help...
Ohhhh, I got it.
PutOnPath doesn't use hash.
This should work:
iTween.PutOnPath(this.gameObject, iTweenPath.GetPath("Gamba1"), 50);
The last parameter is not a value between 0 and 100, it is a value between 0 and 1 where 50% would be .5.