Speed is not constant. It looks like it’s using time instead of speed, since it slows down when the path points are closer together and speeds up when they are further apart.
Even though easetype is set to linear, it looks like it’s easing in and out of the animation.
It does not call the oncomplete function (in the same script) when it gets to the last point in the path, it just stops.
The others, like orienttopath and looptype, seem to work, since the animation behaves differently depending on how they’re set. Is there something I’m doing incorrectly?
I’m not totally sure about the first 2. Perhaps it’s because of your path? I think the distance between the points affect how it works? really not sure on those.
The “oncomplete” needs to be followed by “oncompletetarget” param, which should be a reference to the GameObject that the oncomplete function should be called. Usually it’s just this.gameObject. So essentially:
It’s a pretty simple path with about 20 points. When it goes around curves, the points are closer together and it slows down then speeds up on the straight parts.
In the one line of sample code I could find, the target was not specified, so I assumed “this” was the default. I’ll try that when I get back to my computer.
From the docs, it sounds to me like setting time adjusts the speed to finish in a fixed time, while setting speed runs at a constant speed, but that’s not what I’m seeing.
I forget the term for this, all the tween plug ins have this. However, some have the option to set this to true or false, while I am pretty sure iTween does not.
I’ve also noticed that islocal doesn’t seem to work either. I have a child that is supposed to move around relative to the parent while the parent moves around the scene. If I set it to loop, it runs correctly along the path during the animation, but at the end it jumps to some distant location then back before starting over again. It looks like it’s jumping to the world coordinates of the path, then back to local when the loop continues. The path only has four points, the object moves around in a circle.
Oh, and Stop (with no parameters) doesn’t work. It only stops 3 of the 4 currently looping animations. I have to stop each one by name to get them all.
Is there possibly a newer version of this plugin? I got it from the Asset Store just a couple of days ago, but it seems very unfinished.
I am referring to the non constant speed of travel along an iTween path.
As far as there being a newer iTween plug in, Bob, who made iTween, has told me a while back that he has no plans to develop a newer iTween. He is more in twined with augmented reality. That being said, I converted to HOTween and love it. It is a bit tougher to pick up, but very flexible and light weight on the engine.
I never really had any of the issues you are talking about, however, if this helps, please use it, it is in JS tho. It has a good example of setting a hash table, how you set multiple parameters in iTween.
I gave up on iTween, and am now trying HOTween, my fourth animation plug-in, so far. After a few hours, I got it mostly working. Still two problems: One, it’s not calling the complete function. Also, the object does a quick 180 deg turn at the end of a path (looping or not). On a simple two-point path, loop = 1, it turns around and faces the first point when it stops. On a closed path, it does a 180 then another 180 to start the next loop. I’m obviously doing something wrong, since that same line of code does not behave that way in the example script.
I also get 4 or 5 of these errors:
I’m only trying to do one fairly simple animation. I never imagined I’d have so much trouble with one line of code.
HOTween.To(trainTransform, 8, new TweenParms().Prop("position", new PlugVector3Path(tPath, EaseType.Linear, false).OrientToPath()).SpeedBased().Loops(1).OnStepComplete(PlayExplosion));
The path is a Vector3[ ] with a variable number of user-defined points.
No, I don’t see anything about that in the docs or sample projects, or know how that would work in JS. The path has to be a Vector3[ ], so I don’t know how I could define it as a Tweener type. From the docs, it sounds like Tweeners are created and handled automatically when you call HOTween.To.
OnComplete and OnStepComplete appear to be the same, at least in my case.
It appears to be following and orienting to the path correctly. It just adds an extra bit at the end, after it gets to the last point in the path, where it spins to face the first point. I’d like it to just stop at the end of the path.
Here’s the line from the included example paths scene:
HOTween.To( target1, 8, new TweenParms().Prop( "position", new PlugVector3Path( path ).ClosePath().OrientToPath() ).Loops( -1 ).Ease( EaseType.Linear ).OnStepComplete( PathCycleComplete ) );
I copied it verbatim, almost. IT works in the example scene, but when I put this line into my project, it behaves the same way, with that extra spin at the end. If I animate a cube primitive, it does the same thing, so it’s not something unusual about my model. Doesn’t matter if my model is a child of something or not. It also doesn’t matter if the path is closed and looping, or open ended and only plays once.
You: No, I don’t see anything about that in the docs or sample projects, or know how that would work in JS. The path has to be a Vector3[ ], so I don’t know how I could define it as a Tweener type. From the docs, it sounds like Tweeners are created and handled automatically when you call HOTween.To.
I suppose it is actually not necessary to declare the Tweener, but if you do, you can call it later, like tweener.Play(), tweener.Restart(), etc…
Edit.
just going over my code. I know it is ugly. I made it a while back and since my skills have grown quite a bit. Regardless, what you need to do is something like this…
var pathPositions : Vector3[];
var path : Tweener;
path = HOTween.To(transform, someTime, new TweenParms()
.Prop("position", new PlugVector3Path(pathPositions, PathType.Curved))
);
It’s the OrientToPath that’s causing the extra rotation at the end. As I said, it follows the path correctly till the end, when it spins to face the beginning. Without OrientToPath, it just stops as I expect it should.
Still can’t get the complete function to trigger.
I started out writing my own animation code, since it’s really pretty simple, just straight X and Z movements with the occasional rounded 90-deg turn. I got bogged down with the turns, trying to generate smooth, rounded curves and getting it to orient to the path. I thought an animation plugin would make these simple motions trivial to implement. But with the amount of time I’ve spent trying to figure out these various plugins, I probably could have had my own code working by now.
Yah, the problem with plug ins is that unless there is impeccable documentation, learning them, can be a pain in the ass. To tell you the truth I bugged the heck out of Daniele, the guy who wrote HOTween. He has been and continues to be very helpful. It is a very good product once you learn it. It can tween any value of any component. Scale, position, sure, but also values like orthographic camera size. Any variable at all, even ones you create like numberOfDudes. Being able to pause, play and perhaps most importantly ease these values is very helpful.
If you play my game below, I use it for most enemy movements, and perhaps most notably all camera movements and zooms, plus HUD animations.