Itween paths and generating nodes won't work. please help

Hello human beings!

I am trying to use Itween Paths to “record” the position of the player in some given times and then create a cube that will run through the recorded positions.

Currently i am able to record the positions of the player and copy them to another Itween paths code on the cube but i have ran into some problems i hope you might be able to help me:

  1. The positions of the player are being recorded only if the Game object the records them is selected in the hierarchy.
  2. The cube won’t go through the points or even move.


Recording script:

void UpdateActions(){                                            //Being called every 0.25 seconds.
		if (canRecord) {
			if(timePassed != 0){
				walkingPath.nodeCount = (int)(timePassed / recordingDistance) + 1;
				walkingPath.nodes [walkingPath.nodeCount - 1] = player.transform.position;

			timePassed += recordingDistance;

Walking script:

void Update () {
		iTween.MoveTo(gameObject, iTween.Hash(
			"path", iTweenPath.GetPath("myWalkingPath"),
			"time", 5, 
			"orienttopath", true));

If you can help me that would be great.


You haven’t coded the hashtable correctly. Your walking script should be like this:

iTween.MoveTo(gameObject, new Hashtable {
    { "path", iTweenPath.GetPath("myWalkingPath") },
    { "time", 5 }, 
    { "orienttopath", true } });

Also, since you’re manually setting positions for the path you don’t need to be dealing with the iTweenPath class. Instead you can just use a Vector3[] or better yet a List<Vector3> . This will give you full control and make sure nothing’s going wrong behind the scenes out of your reach, if you get what I mean…