- Home /
How to set iTweenpath dynamically
Plz tell me how to set iTweenpath dynamically. Or it would also be nice if you tell me how to perform sequence of moves using iTween. **my code: this is not working || Log prompts like: no path with that name (positions) exists!
Vector3[] positions=new Vector3[3];
positions[0]=new Vector3(18.5f,3.8f,1.6f);
positions[1]=new Vector3(18.5f,4.8f,1.6f);
positions[2]=new Vector3(18.5f,4.8f,2.6f);
positions[3]=new Vector3(14.5f,4.8f,2.6f);
iTween.MoveTo(players[1], iTween.Hash("path", iTweenPath.GetPath("positions"),"time", 8.0f));
Answer by robertbu · Feb 22, 2014 at 07:48 PM
iTweenPath.GetPath() gets an array of Vector3s created by the iTweenPath editor. You are creating the array directly, so you don't need to deal with the iTweenPath class. You can just do:
iTween.MoveTo(players[1], iTween.Hash("path", positions, "time", 8.0f));
And a minor issue: you create an array with three positions, but you assign values to four positions. You need to increase the size of your array to 4.
Your answer
Follow this Question
Related Questions
iTween movetopath 1 Answer
Using iTween to move a gameobject from node to node 1 Answer
iTween MoveTo/MoveUpdate 1 Answer
iTweenPath Issues in windows? 1 Answer
iTween 2D Path rotation 1 Answer