- Home /
iTweens MoveTo and "path" property
Hi there,
I don't know, what I'm doing wrong here, but I can't seem to use the "path"-property within MoveTo. Here's the code snippet I use:
iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath("Path1"), "time",5));
or more explicitely this one:
iTween.MoveTo(gameObject, iTween.Hash("path",[Vector3(1,2,3),Vector3(2,1,3),Vector3(3,2,1)], "time",5));
The object to which the code is attached doesn't move at all. However if I add "movetopath",false it will stick right to the first node of the path - but won't move as well.
iTween was a big help so far and I checked the examples for PutOnPath and PointOnPath but the Path-Editor + MoveTo seems more like the solution for me because of the easing for the movement.
Answer by pixelplacement · Mar 16, 2011 at 04:04 PM
That's odd - are there any other scripts on the GO?
Hi Bob, yes I currently have both path solutions going in my scene. the one from the PutOnPath-example and the Visual Path Editor. I'm removing the PutOnPath scripts now. let's see what it does.
Nope, nothing happened. I switched off all scripts now and deleted the pathPoints from the previous script. One thing maybe: I placed the iTweenPath c#-script and the Editor-folder in the Plugins-folder - just where iTweens is located. Is that correct?
Answer by pixelplacement · Mar 31, 2011 at 09:24 PM
Is this resolved?
sorry, for replying so late. I worked a different approach for this not utilising itween though.
But I figured that the $$anonymous$$oveTo method combined with paths only works at Start() or any other one-shot functions but not in Update(). That seems to be the case with most of iTweens methods (ColorFrom e.g.) $$anonymous$$aybe that is a UnityScript restriction?
@Stefan 4: Umh, when putting the iTween call in Update(), you will probably call it each frame, which is not a good idea. Each iTween creates a temporary iTween objects that's attached to the calling object, and which has an Update() function on its own, doing the tweening. There's no need / it's not the intention to call iTween.Whatever every frame.
Answer by Stefan 4 · Mar 17, 2011 at 01:46 PM
I prepared a simple and small test-project. Perhaps someone can figure it out. I might be totally wrong, with what I'm doing, so any help would be much appreciated!
Here's the file: http://www.sendspace.com/file/2se5fr
Answer by ben · Mar 18, 2011 at 11:34 AM
surely it ll work specify the name of the path u have created correctly
iTween.MoveTo(gameObject, iTween.Hash("path" , iTweenPath.GetPath("CamPathForward"), "time" , 10, "easeType", iTween.EaseType.easeInOutSine));
CamPathForward - path name ...v created using pathEditor script
Yep, that's exactly what I did. Please have a look at the test project which I posted above. $$anonymous$$aybe you will be able to spot the problem in no time.
do u have iTween & iTweenPath script in c# or .js......teh script i have posted is in c# it will work only with c# scripted iTween packages
yes I'm using javascript but your line and the syntax also works in javascript!
Answer by newnixon · Apr 30, 2012 at 04:34 PM
I am having a similar issue. I have a truck with a camera inside the cab showing all the different types of radios. I have a gui that you click to take down each path depending on which radio you choose. The itween paths work and it flows well, the issues comes in when I attach a script to the camera to make it look to a cube that i have animating using moveto. I couldn't figure out how to rotate the camera toward an object once the path ended so I use the
void Update () { transform.LookAt(target);
}
The target is the cube.
This works but he camera is jittery as it travels down the path to look at the cube. If I take off the LookAt script, the camera runs smooth but the camera is not looking at the object. There is no colliders on the box. Do you have any solutions?
Your answer
Follow this Question
Related Questions
Go back to first node (itween + moveto) 2 Answers
iTween, moving to a node on a path. 1 Answer
iTween - look for new path, move to or reverse at end? 0 Answers
iTween Camera Jitter while moving on path 2 Answers
itween MoveTo IndexOutOfRangeException 0 Answers