Unity Community |

I second Himatako's suggestion. One thing I attempted to do with iTween was to use it for an FPS camera bobbing motion that was character speed dependent, but I was unable to adjust the 'bob' amount on the fly; iTween needs to finish what it's currently doing before a param can be adjusted.
Having the abillity to have constant motion every frame with all subsequent eases and be able to adjust this smoothly on the fly, mid-tween, for greater or lesser motion, would be ideal.
Good stuff here Izitmee.![]()
Steve Bodnar - Animation Director
FlipFrame Animation/Games
Recent Project - Bioshock Infinite
Current Project - 'Unreleased'
@himatako: oops! Actually, strings should be able to be tweened by default, without using a plugin. Just added this option and it will be available in the next update (with those other options).
@SteveB: what you're suggesting looks like an interesting addition to what Himatako said, I'll try to add it too. As of now, I planned to add the possibility of changing easing, loops, etc. on the fly, but not the "end value" to reach, which instead I suppose you're referring to. I'll definitely look into it within the week (right now I'm totally stuck into allowing tweens to animate with constant speed along a Catmull-Rom path: I thought I contrived a kind of inexpensive and fast way to do it, but though the logics and implementation look correct, it's not working :P).
P.S. hey it's an honor to see you checking HOTween, seeing your incredible curriculum![]()
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Is the OSX version ready for primetime yet?
www.pixelsteam.com
twitter @pixeltrek
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Hey guys, just found this as I was looking for a way to replace iTween due to so many Destroys() slowing down my game on android.
I really just got into it and am wondering if there is a way to see the code that the visual editor creates? I am pretty sure this was asked about already in the thread but I didnt see a answer.. might have just missed it since I am distracted at work lol
That would make it super simple to learn it![]()
Ok, Now I have some questions
I am trying to make a count down timer to start my game.. I tried 2 different methods neither of which I could get to work correctly.. here is what I tried
First I tried using OnCompletes
Code:
void startCountDown() { if(doCountDown) { HOTween.To(numParent.transform, 1, new TweenParms().Prop("position", new Vector3(16,countDownYonScreen,-92)).OnComplete(countDownThreesLocal)); } } public static void countDownThreesLocal() { } void countDownTwosLocal() { } void countDownOnesLocal() { } void countDownDoneLocal() { }
When I do it this way, each number scales up twice. Three scales up then down, then two and three scale up then down, then two and one, then one.
then I tried using a sequence
Code:
void startCountDown() { if(doCountDown) { //countDown sequence Sequence theCountDown = new Sequence(new SequenceParms().OnComplete(countDownDoneLocal)); theCountDown.Append(HOTween.To(numParent.transform, 0.01f, "position", new Vector3(16,countDownYonScreen,-92))); theCountDown.Append(HOTween.To(numParent.transform, 0.01f, "position", new Vector3(16,countDownYoffScreen,-92))); } } void countDownDoneLocal() { }
this has the same type of effect.. numThree scales up, then resets to zero, then when numTwo scale up, numThree scale up again. This happens for all numbers and calls the OnComplete twice at the end.
Hey ShreddinPB, glad you're trying HOTween
In your example, Sequence is definitely the way to go. I tested it out, and it works perfectly: are you sure that "startCountDown" is not called multiple times? I built a working sample, using exactly your code, and everything runs as expected.
You can get the UnityPackage with the sample "Counter" scene I created to test it out here (HOTween DLL is not included, you will have to add it, or just import the package in your current project). I used your code, and placed it inside "CounterBrain.cs", which is a MonoBehaviour attached to the empty gameObject "_Brain", and I used colored cubes instead of numbers to do it more quickly (I have to rush to get a plane).
About the Visual Editor, it is not a code generator (and nope, nobody asked that question yet), thus there's no way to see its output. But I might create a visual helper that does that.
Also, I'm sorry but I'm leaving now and will be travelling for two days, thus I'll be back to the forums only on thursday (timezone is GMT+1) :P
Last edited by Izitmee; 01-24-2012 at 01:56 AM.
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Thank you very much Izitmee and Himatako
I'm going to check it out hope i#ll get it to work with my less coding skills lol
great that you responded that fast and detailed!
There is no need to be sorry!Hey ShreddinPB, glad you're trying HOTween
In your example, Sequence is definitely the way to go. I tested it out, and it works perfectly: are you sure that "startCountDown" is not called multiple times? I built a working sample, using exactly your code, and everything runs as expected.
You can get the UnityPackage with the sample "Counter" scene I created to test it out here (HOTween DLL is not included, you will have to add it, or just import the package in your current project). I used your code, and placed it inside "CounterBrain.cs", which is a MonoBehaviour attached to the empty gameObject "_Brain", and I used colored cubes instead of numbers to do it more quickly (I have to rush to get a plane).
About the Visual Editor, it is not a code generator (and nope, nobody asked that question yet), thus there's no way to see its output. But I might create a visual helper that does that.
Also, I'm sorry but I'm leaving now and will be travelling for two days, thus I'll be back to the forums only on thursday (timezone is GMT+1) :P
I will double check everything then, when I was using iTween it wasnt getting called twice (or wasnt acting like it was) so I assumed it was only calling once.. I will trace and find out where my code is wrong!
Thanks for looking into it!
Have a great trip![]()
New update (v0.8.006)
- You can animate with constant speed along a path (chaining the ConstantSpeed parameter on the PlugVector3Path plugin).
- You can make speed-based instead than time-based tweens (chaining the SpeedBased parameter on TweenParms).
- String properties can be animated using defaults (meaning they don't need PlugString to be used directly).
Now moving to the implementation of runtime parameter changings.
P.S. ShreddinPB, the trip was terrible, but now that I arrived I'm happyLet me know if you find what was wrong or if you need more help.
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Damn! Im sorry to hear the trip sucked, but cool that the final result is goodNew update (v0.8.006)
- You can animate with constant speed along a path (chaining the ConstantSpeed parameter on the PlugVector3Path plugin).
- You can make speed-based instead than time-based tweens (chaining the SpeedBased parameter on TweenParms).
- String properties can be animated using defaults (meaning they don't need PlugString to be used directly).
Now moving to the implementation of runtime parameter changings.
P.S. ShreddinPB, the trip was terrible, but now that I arrived I'm happyLet me know if you find what was wrong or if you need more help.
Yeah. I got it to work, there was a little bump in the road tho.
In my head, setting up the sequence was just setting it up, and not playing it.. so since it automatically plays I was a bit confused. I just added a Pause() after all the Append()s and then just called Play() when I needed it to play.
Code:
using UnityEngine; using System.Collections; using Holoville.HOTween; using Holoville.HOTween.Plugins; public GameObject numbersParent; public GameObject numOne; public GameObject numTwo; public GameObject numThree; int countDownScaleTo = 1; public static int countDownYonScreen = 200; public static int countDownYoffScreen = -38; public static Sequence theCountDown; { theCountDown = new Sequence(new SequenceParms().OnComplete(countDownDoneLocal)); theCountDown.Append(HOTween.To(numbersParent.transform, 0.01f, "position", new Vector3(16,countDownYonScreen,-92))); theCountDown.Append(HOTween.To(numbersParent.transform, 0.01f, "position", new Vector3(16,countDownYoffScreen,-92))); } { } public static void countDownDoneLocal() { levelAimer.okToShoot = true; doMoveDown.startLevelTimer = true; } }
I do have another question if you have a minute.
In my game, the objects you are going to lob are lined up on a path. Lob your object and the others on the que path will shift forward like they are stacked up on the path.
I searched around and am having trouble figuring this out
I am having a hard time figuring any of it out hahahaha
How do I create a path?
How do I animate along that path, but just to a certain point along the path, like move from 50% of the way to 60% of the way?
As much as it seems I am asking you to just write it, I really am not lol just with no working example that I can find of how the path animation system works, I cant pick it apart and figure it out![]()
To create a path, you just store an Array of Vector3 points, and then use PlugVector3Path to animate it. I just created an example (Path Basics) on HOTween's website, so you can download it and see how it works
When you animate on a path, the tween moves along the whole path (though what you're asking is quite interesting, I will see if I can add a "partial tween" option in the near future). But you can "jump" to a position in time using GoTo or GoToAndPlay, and then use the OnUpdate callback to do something when it goes beyond a certain time position:
Note that in the above code I stored the tweener as an IHOTweenComponent instead than as a Tweener: IHOTweenComponent is an interface which you can use both for Tweeners than for Sequences, thus controlling them (with GoTo and other methods) in the same way.Code:
using UnityEngine; using Holoville.HOTween; using Holoville.HOTween.Plugins; /// <summary> /// Attach this class to an empty gameObject in the scene. /// </summary> { private IHOTweenComponent tweener; { tweener = HOTween.To( myTransform, 2, new TweenParms().Prop( "position", new PlugVector3Path( myPath ) ).OnUpdate( PathUpdate ) ); // Jump to 50% time position (1). // GoTo moves to the given position and doesn't change the play mode // (meaning the tween will goto and play if it was playing, or goto and pause if it was paused). tweener.GoTo( 1 ); // I add this to show the path in the Editor (if the Gizmos button is selected). HOTween.showPathGizmos = true; } void PathUpdate() { // If the time position is higher than 60% (1.2) of the duration, // move back to 50% duration and go on playing. // This will create an infinite loop between 50% and 60% time position. tweener.GoTo( 1 ); } } }
P.S. what you said about Sequence sounds totally right... Tomorrow I will probably change its behaviour so that it doesn't start automatically anymore![]()
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
That totally rocks! I can work with that.. I just tested and can use Pause() on it also.. so I can set it to pause when it gets to a certain point, then play again when I need it to moveTo create a path, you just store an Array of Vector3 points, and then use PlugVector3Path to animate it. I just created an example (Path Basics) on HOTween's website, so you can download it and see how it works
When you animate on a path, the tween moves along the whole path (though what you're asking is quite interesting, I will see if I can add a "partial tween" option in the near future). But you can "jump" to a position in time using GoTo or GoToAndPlay, and then use the OnUpdate callback to do something when it goes beyond a certain time position:
Note that in the above code I stored the tweener as an IHOTweenComponent instead than as a Tweener: IHOTweenComponent is an interface which you can use both for Tweeners than for Sequences, thus controlling them (with GoTo and other methods) in the same way.Code:
using UnityEngine; using Holoville.HOTween; using Holoville.HOTween.Plugins; /// <summary> /// Attach this class to an empty gameObject in the scene. /// </summary> { private IHOTweenComponent tweener; { tweener = HOTween.To( myTransform, 2, new TweenParms().Prop( "position", new PlugVector3Path( myPath ) ).OnUpdate( PathUpdate ) ); // Jump to 50% time position (1). // GoTo moves to the given position and doesn't change the play mode // (meaning the tween will goto and play if it was playing, or goto and pause if it was paused). tweener.GoTo( 1 ); // I add this to show the path in the Editor (if the Gizmos button is selected). HOTween.showPathGizmos = true; } void PathUpdate() { // If the time position is higher than 60% (1.2) of the duration, // move back to 50% duration and go on playing. // This will create an infinite loop between 50% and 60% time position. tweener.GoTo( 1 ); } } }
P.S. what you said about Sequence sounds totally right... Tomorrow I will probably change its behaviour so that it doesn't start automatically anymore
But yeah, being able to just set a distance along the curve to move to would be great.. possibly to the parametric length 0.5 half way, something like that
Cool, glad I can contribute some ideas
as a note, when I go to the link for your examples http://www.holoville.com/hotween/examples.html it just says "Coming Soon!"
Hi Izitmee,
Just wanted to let you know I'm using HOTween in my new project, and it's really fantastic. It's a bit challenging to figure out how to manually execute some of the stuff iTween does automatically with all it's methods, but it's worth it because you have way more control over your code, and there are no Hashes!
I wish there was some way around having to use a string in Prop, but it's easy enough to just pop the hints up for whatever script you are trying to tween.
Keep up the great work!
Ooops, sorry, that's a cache issue. If you press refresh on your browser the example should magically appearwhen I go to the link for your examples http://www.holoville.com/hotween/examples.html it just says "Coming Soon!"
@Smorpheus: thanks a lot for letting me know, I'm very glad you're liking itI tried all possible hacks not to use a string to define the property to tween, but that was truly impossible (unless, maybe, I'd decide to go with "unsafe" code, but that's a thing I definitely want to avoid).
P.S. 8-bit RPG hooked me! Just seeing those characters made me hunger for it![]()
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Just a quick update (v0.8.007), which I thought I'd mention because of some changes:
The ConstantSpeed parameter I introduced yesterday for paths doesn't exist anymore. This doesn't mean that it doesn't work anymore, but simply that it's now used by default (I realized that there's no use in moving along a curved path without constant speed, thus the parameter was futile).
As rightfully suggested by ShreddinPB, Sequences are now created in a paused state, and you will need to call mySequence.Play() to start them.
As usual, you can get it all on HOTween's website.
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Hey man, not sure if I am doing something wrong, or if its a bug.
I downloaded the newest update and copied it over.
When I use the path, a fresh setup or even running the script you posted, there seems to be an extra Vector3 in there.
So in your example you have a vector3 array of 4.. in the editor the path has 5 points
my one I made has 10, but when it plays there is an 11th point that isnt along the path at all.. it seems to be at 0,0,0
Hey, just tried to replicate the issue, even using the script I posted, but I can find no additional points.
Consider that, if the target position doesn't coincide with the first path point, HOTween automatically adds a curve leading from the target's position to the beginning of the path. Maybe that is what you're seeing?
Holoville Games | Blog | Illustrations/Comics | Twitter
HOTween : a fast, type-safe, and powerful Unity tween engine
HOTools : a tools panel for Unity
HOUnityLibs : an open-source collection of libraries for Unity
Since I need an alert box, so I decided to quickly code an alert box with HOTween. Hopefully this can be useful, as well as showing how HOTween can be used easily with UnityGUI.
Alert Box with HOTween