iTween, Object Starting Exactly at the First Node?

Im just now starting to use iTween and Im wondering or having difficult getting my Object or Enemy started exactly where the first node is (by the way Im using “Visual iTween Path Editor” http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/). Its an absolutely amazing product cant believe its free.

But heres my problem if anyone knows a solution or if Im missing something please let me hear it :wink: I’ll take any suggestions. I only have 2 nodes 1 2 for a Corridor

My Enemy for the path is located at:

X -105.3922
Y -6.710009
Z 289.1131

And The my first node is placed in the same exact spot: (see attached image)

X -105.3922
Y -6.710009
Z 289.1131

But when the Enemy is triggered to goto the path it seems that the enemy will walk away from the path then after a second or two finally goes onto the path? and with him walking away from the path or actually not starting where the path is, it looks quirky and I cant figure out how to have it start exactly where it should?

Now if I move the enemy further away from the path to go right on it, it looks a little better but the speed it takes the enemy to get to the path is different than when the enemy is actually on the path soooo Im having difficulty syncing up the walk animation with the speed of the enemy moving 2 different speeds going to the path then on the path.

Ive been at this for 2 days now and am starting to think it may have something to do with global positioning or something but I cant be sure??? Im just not that smart lol. There is also a small noticeable difference with the speed the enemy going from node1 to node2 but thats ok Id just be happy to have the enemy start where it should to alleviate the quickyness of him starting to move on his path and having 2 different speeds.

Im not intentionally pointing the bad things Im just trying to figure out how to solve this because Its a sweet tool to have and to use especially for enemies and paths its SWEET and easy to use.

Can anyone help? or know of a solution I’ll take any suggestions :smile:

var enemy1 : GameObject;
var timeWalking : float = 6.0;

function ActivateEnemy()
{
	iTween.MoveTo(enemy1,iTween.Hash("path",iTweenPath.GetPath("Corridor"),"time",timeWalking,"lookTime",0.2,"easetype",iTween.EaseType.linear));
}

487682--17135--$Picture 3.png

I did find somewhat of a workaround.

I put node1 right next to the enemies end point so he will travel the same speed all the way to node1 and just put node2 pretty much on top of node1 for his finish. So his actual starting point is no where near node1 he will walk to it and end at it at well :slight_smile:

Now hopfully going to the next iTween Path (new node path 1 2) I dont have the same issue because this one will be a ping pong, I’ll find out tomorrow bedtime for bonzo :slight_smile:

I’m glad iTween and the visual path editor are working well for you. To solve this problem just set “moveToPath” to false and all of these issues will go away for you. By default iTween generates a curve to the first point on the path. If the object is too close to the starting point then the curve that is created will be very “pinched”.

Thanks for the support and acknowledgment! Adding moveToPath as false should not be causing your path to stop working - might be a bug on my end. Can you get me a sample project so I can test this out?

Ok probably the last bit for tonight I decided to delete the enemy and use a standard cube it took a while for it to work but now just using a cube with the “movetopath”,“false” commented out it works :slight_smile: but with the curve at the beginning.

iTween.MoveTo(gameObject,iTween.Hash("path",iTweenPath.GetPath("Corridor"),/*"movetopath","false",*/"time",timeWalking,"lookTime",0.2,"easetype",iTween.EaseType.linear));

Now if I uncomment that bit (“movetopath”,“false”,)

iTween.MoveTo(gameObject,iTween.Hash("path",iTweenPath.GetPath("Corridor"),"movetopath","false","time",timeWalking,"lookTime",0.2,"easetype",iTween.EaseType.linear));

I get this error InvalidCastException:

InvalidCastException: Cannot cast from source type to destination type.
iTween.GenerateMoveToPathTargets () (at Assets/Plugins/iTween.cs:3491)
iTween.GenerateTargets () (at Assets/Plugins/iTween.cs:3116)
iTween.TweenStart () (at Assets/Plugins/iTween.cs:4539)
iTween+<Start>c__Iterator2.MoveNext () (at Assets/Plugins/iTween.cs:6065)

Im not sure where or why this is happening in the scene? plus IsRunning will not be checked? like above

It seems like something in this scene is causing itweens movetopath not to work I have no idea what it could be? if I create a new scene in the same project using the same scripts it works? So far this is the first path in this scene which also makes no sense.

I may have to create a whole new scene I just dont want to waste all of that time if I get the whole new scene created and have the same issue but I guess theres only one way to find out. Ahh this is daunting lol.

Ahhhhhhhh… Finally figured it out.

Doh… All this time I just needed to take out the quotes “” around the false. BUT YAY!!! Im back in business :smile: