Search Unity

HOTween: a fast and powerful Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Jan 7, 2012.

  1. Crwth

    Crwth

    Joined:
    Mar 1, 2014
    Posts:
    6
    Cheers! I need to scroll slower...

    (p.s. love the library -- thanks!)
     
  2. adk172

    adk172

    Joined:
    Mar 16, 2014
    Posts:
    9
    I'm on Windows 7 and I've downloaded this on the website:

    HOTween v1.3.320 (.zip)
    It's a simple DLL assembly, which works both on Windows and on Mac.

    my Unity project is actually set for iOS, I've also tried the HOTweenMicro v1.3.320 (.zip) but I got the same error
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Crwth Cheers to you :)

    @adk172 You cannot build for iOS from Windows (Unity doesn't support it), so I suppose the problem lies there
     
  4. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    114
    Hi Izitmee, and anyone else who might help.
    I have a plugVector3 path animating a camera, with an array created by the user clicking on a collider. At each click, the I'm also storing another float array for the camera's ortho.size. The path tween all works very well, but I'm also wanting to tween a the stored float between each of the way points. I was wondering if you could give me a pointer about how to do this?
    I get the sense that this is similar to MrFoamy's question about getting waypoint data on the previous page. Cheers.
     
    Last edited: Jun 25, 2014
  5. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I've been receiving this crash in xCode while using HoTween Micro with Stripping Level: Strip ByteCode. It happens when the timer is complete.

     
  6. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Hey Demigiant, I found a bug in current version of HOTween... if you try and tween Vector4 or Vector2 types, it seems to try and cast them to Vector3 somewhere internally and spits out a bunch of InvalidCastException simply doing this reproduces the bug :

    Code (CSharp):
    1. public Vector4 Vec4Test;
    2. void Start () {
    3.     HOTween.To(this, 1f, new TweenParms().Prop("Vec4Test", new Vector4(0, 0, 1, 1)));
    4. }

    Hope you can fix it soon :)
     
  7. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    New HOTween Update: v1.3.326

    - Fixed Vector2/4 tweens being broken in previous version

    As usual, latest version is on the website.

    @Quickfingers Fixed :)

    @Ben BearFish There is no HOTweenTimer class in HOTween. I suppose something inside your callback method is generating that error.

    @bigSky Sorry but there's no tween method to know if you've reached a waypoint. Maybe you could check Simple Waypoint System by @Baroni which uses HOTween and adds a lot more options to path management.
     
  8. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    HOTweenTimer is just a class I have with a HoTween tween inside. I have a parms which calls parms.OnComplete(), which I pass in a void method called OnCompleteEvent.

    So it looks like this:
    Code (csharp):
    1. private void OnCompleteEvent()
    2. {
    3. }
    4. parms.OnComplete(OnCompleteEvent)
    It seems the crash is happening when the HoTween is Complete and the OnComplete is called. From some research I found this "a JIT compile error is usually related to dynamic typing on iOS".

    This makes me believe that parms.OnComplete(OnCompleteEvent), is dynamically casting my void OnCompleteEvent() method to a Holoville.HOTween.Core.TweenDelegate.TweenCallback which is then causing the xCode crash with stripping. I'm going to try to change the void method OnCompleteEvent to a TweenCallback in code to test this. Until then, do you think there might be an easier solution to this problem.

    EDIT:
    I changed my void OnCompleteEvent to a TweenCallback and now the crash does not happen, which leads me to believe the casting from a void method to TweenCallback is causing the crash.

    Also, I'm using HoTweenMicro v1.3.326 with Strip ByteCode for the Stripping Level.
     
    Last edited: Jun 28, 2014
  9. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    thankyou for the speedy fix :D
     
  10. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    arg I've noticed the same Vector4 bug is now re-surfacing when tweening colors.
     
  11. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
    Hi guys!

    I have a single prefab, button, that I can setup in the 4 cardinal directions.



    I have this component setup for the prefab.

    I am trying to figure out how to set it up so that the button, when pressed, will always move downward even if its pointed at 90, 180, 360 etc

    I tried using localPosition and moving it on the Y, but it doesn't seem to work.

    Thanks!
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    New HOTween Update v1.3.327

    - Fixes Color tweens being broken in a previous update

    As usual, latest version is on the website.

    @Quickfingers ooops, sorry, This update fixes it. I recently made a change to HOTween, adding some overloads that rely on type, and apparently Color types are implicitly casted to Vector4 *_*

    @TobiasP I am not sure I understand. You want the button to move downwards, but with the "downwards" based on the object's rotation? Then you'll have to create a tween via script, and find yourself the direction in which to move your button, since there's no "move based on rotation" shortcut (and when you rotate something, Unity doesn't change the orientation of its axes, so localPosition won't help).
     
  13. VigorousApathy

    VigorousApathy

    Joined:
    Dec 22, 2012
    Posts:
    12
    I'm trying to tween the alpha values of a Line Renderer using SetColors() with little luck (simple fade in and fade out). Wondering if there's an easier way to set this up?

    Here's the code I've been messing with to get that to work:

    Code (JavaScript):
    1. var invisible : Color = Color(1,1,1,0);
    2. var invisible2 : Color = Color(1,1,1,0);
    3.  
    4. var visible : Color = Color(1,1,1,1);
    5.  
    6. function ShowOrbits()
    7. {
    8.     for(var i = 0; i < orbitArray.Length; i++)
    9.     {
    10.         var line : LineRenderer = orbitArray[i].GetComponent(LineRenderer);
    11.         line.SetColors(invisible,invisible2);
    12.  
    13.         HOTween.To(invisible, 2f, new TweenParms().Prop("a", 1));
    14.         HOTween.To(invisible2, 2f, new TweenParms().Prop("a", 1));
    15.     }
    16. }
    17.  
    18.  
    There are no errors, HOTween does not kick back any issues, but the Line Renderer stays visible. Essentially I just want to tween the alpha value from 0 to 1 and vice versa.
     
  14. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    The Color class is a struct in Unity, and thus a) won't behave as a reference, b) you won't be able to change the "a" value directly. I'd suggest you just create a float variable and tween it from 0 to 1, then use HOTween's OnUpdate callback to call SetColors and apply them accordingly.
     
  15. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
    @Izitmee I tried figuring out how to do it via script, but I cannot seem to find out how to do a TWEEN BY with relative. I could only see TWEEN TO and TWEEN FROM in the docs. (I probably just didn't see it)

    Would it be possible to get a quick example based on this image of what it would look like in script?



    Thanks!
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @TobiasP The Tween BY option via script is turned on by setting a tween as relative. To replicate that image, it would look like this:
    Code (csharp):
    1.  
    2. HOTween.To(this.transform, 0.2f, new TweenParms()
    3.   .Prop("position", new PlugVector3Y(-0.05, true)
    4.   .UpdateType(UpdateType.FixedUpdate)
    5.   .Ease(EaseType.Linear)
    6. );
    7.  
    The "true" inside the PlugVector3Y method is the one that sets the tween as relative, and as such as BY :)
     
  17. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
  18. VigorousApathy

    VigorousApathy

    Joined:
    Dec 22, 2012
    Posts:
    12
    After messing with this forever, I finally figured out a solution in addition to adding light to why it was not working in the first place.

    Code (JavaScript):
    1.     for(var i = 0; i < orbitArray.Length; i++)
    2.     {
    3.         var orbitColor2 = Color(.5,.5,.5,alpha);
    4.         orbitArray[i].renderer.material.SetColor("_TintColor", orbitColor2);
    5.         HOTween.To(this, 3f, "alpha",.5);
    6.     }
    Part of the reason it was not working is that I had the function only called once when the down button was pressed, but for some reason the shader needed to be called every frame for the fade to work correctly. I'm only a hobbyist, so I'll mark it as a lesson learned.
     
  19. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
    @Izitmee For some reason I cannot seem to figure this out.

    When I added your script, it said i was missing ABSTweenPlugin for PlugVector3. I downloaded the .cs and added it the the plugins folder.

    Then It said I was missing Easing. I downloaded that cs and also added it.

    Now I am getting an error:

    "Holoville.HOTween.Core.EaseInfo.GetEaseInfo(Holoville.HOTween.EaseType)' is inaccessible due to its protection level"

    How would I write the same code you sent me without using this plugin or how would I get this plugin working?

    Sorry for asking so much :(

    Thanks!
     
  20. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @TobiasP sorry, I'm so used to Visual Studio adding the "using" part semi-automatically that I forgot to mention it. Remove all those HOTween cs files you downloaded, since they will mess up with the DLL. Then, just add
    Code (csharp):
    1. using Holoville.HOTween.Plugins;
    to the top of your class :)

    @Shirosynth glad you got it working :)
     
  21. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
    @Izitmee I had tried that, but it didn't work.

    Then I realized it was because of a typo in the "("....

    Sorry for wasting your time :(
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @TobiasP Aha, the important thing is that now it's solved ;)
     
  23. Sinaz20

    Sinaz20

    Joined:
    Nov 16, 2009
    Posts:
    53
    EDIT: Nevermind-- it was the whole using-the-gameobject-as-the-target that was breaking it. SOLVED.

    I've run into an issue-- It seems that HOTween.To() is suddenly returning null rather than a tweener. I can't figure out what about my code has changed to cause this.

    Hopefully it's some small thing I've overlooked and you're aware of such a user oversight.

    I create the tweeners, then the moment I access one, it throws the following error:

    The code I use to initialize the tweeners is:

    Code (CSharp):
    1. HOTween.Init( true, false, true );
    2.         _openTweener = HOTween.To (gameObject, _openDuration, new TweenParms().Prop ("_tweenUvX", _openEaseTarget).OnComplete(EndTween).Delay(_openEaseDelay).Ease (_openEaseType).AutoKill(false).Pause());
    3.         _closeTweener = HOTween.To (gameObject, _closeDuration, new TweenParms().Prop ("_tweenUvX", _closeEaseTarget).OnComplete(EndTween).Delay(_closeEaseDelay).Ease (_closeEaseType).AutoKill(false).Pause());
    And the part of the code that throw the error is a GotoAndPlay() call on one of the tweeners.

    Any ideas on what I should examine to solve this?

    Thanks.
     
    Last edited: Jul 5, 2014
  24. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I have a little problem with tweens when I what to run some at the same time. I will try to explain my situation:

    1) I have a parent object
    2) I have a child of the parent in 1
    3) I apply a tween that makes the child object move fast from left to right a little offset (like saying No)
    4) Then I apply on the parent a tween that will translate the parent down (and obviously would do the same with the children)

    The situation is that it seems that the tween on the child overlaps the with the parent movment and it doesn't go down (parent does though). How do you mange this kind of things?

    Edit:

    1) What is the best way to handle conflicting tweens (like the situation I explained before)?
    2) I'm trying to use PlugVector3X with a Shake but the shake seems to not take the PlugVector3X plugin into account (it does same amplitude independly of the value I pass in the prop call).

    Thansk in advance.
     
    Last edited: Jul 7, 2014
  25. NeophyteGamer

    NeophyteGamer

    Joined:
    Aug 26, 2013
    Posts:
    38
    i get this error when I get something is immediately destroyed after spawning that needs to get tweened:


    NullReferenceException: Object reference not set to an instance of an object
    Holoville.HOTween.Tweener.Startup (Boolean p_force) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:968)
    Holoville.HOTween.Tweener.Startup () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:957)
    Holoville.HOTween.Tweener.Rewind (Boolean p_play, Boolean p_skipDelay) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:897)
    Holoville.HOTween.Tweener.Rewind (Boolean p_skipDelay) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:278)
    Holoville.HOTween.Tweener.Rewind () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:267)
    Holoville.HOTween.Sequence.TweenStartupIteration () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Sequence.cs:830)
    Holoville.HOTween.Sequence.Startup () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Sequence.cs:857)
    Holoville.HOTween.Sequence.Update (Single p_shortElapsed, Boolean p_forceUpdate, Boolean p_isStartupIteration, Boolean p_ignoreCallbacks) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Sequence.cs:612)
    Holoville.HOTween.Core.ABSTweenComponent.Update (Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Core/ABSTweenComponent.cs:884)
    Holoville.HOTween.HOTween.DoUpdate (UpdateType p_updateType, Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:2016)
    Holoville.HOTween.HOTween.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:667)

    not sure if its hotween's problem but "i think i fixed it" by making things invulnerable in the beginning of their lifetime.
    Anyway, thought you might want to take a look because it stops all future tweens and it will not stop complaining if it triggers(it keeps repeating the error i mean).

    if not then please ignore this post ^^;

    thx for making hotween btw.
     
  26. adk172

    adk172

    Joined:
    Mar 16, 2014
    Posts:
    9
    Hi, I got the same error on my Mac (OS X 10.9.3)
     
  27. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Sinaz20 Glad it's solved

    @hexdump The only reason that might be happening is because you're tweening the position of the child, instead than the localPosition :)

    @NeophyteGamer That happens if a tween target is destroyed while the tween is still running. Always take care to kill tweens if you're destroying their target (or changing scene)

    @adk172 That is weird, something must be wrong with the files in your project. Can you post a screenshot of your Project panel, with every folder expanded so I can check what's wrong?
     
  28. JakeShields

    JakeShields

    Joined:
    Feb 23, 2014
    Posts:
    13
    Hi, I have a question.

    Is there any way to make multiple tweeners on one gameobject run together?

    When I call this twice before ons is finished,

    Code (CSharp):
    1. HOTween.To( this, 1f, "CurrentValue", 50, true );
    I expect CurrentValue is increased by 100(50+50)
    But actually it seems second tweener stops the first one so that the value is increased only by 50~100 (depends when the second one is called)
     
    Last edited: Jul 9, 2014
  29. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Thanks for the answer.

    I have found a bug (I think). I'm using a shake with the Vector3X plugin and it does not take amplitude into account. I mean this works:

    Code (CSharp):
    1. HOTween.Shake(cachedTrans, 0.5f, new TweenParms().Prop("localPosition", new Vector3(30, 0, 0), true));
    but this don't :

    Code (CSharp):
    1.  
    2. HOTween.Shake(cachedTrans, 0.5f, new TweenParms().Prop("localPosition", new PlugVector3X(30), true));
    3.  
    This line does a shake but does not take amplitude in x "30" into account. it does always same shake whatever float I use in the PlugVector3X constructor.

    And just another question, is there anyway to get a value from the tweener passing a float (time)? I have a problem and it is that sometimes I want to reset a transform to its original position (prior to running tween). Restart() and Pause() does not work here because I suppose I should be waiting for the next update to occur. So I would like to be able to get the original value doing something like tweeer.GetValueOverTime(0) and killing the ween. Is there any way to do this now with HoTween?

    As always I would like to thank you for this great tween lib. I don't understand why unity doesn't have this built-in.

    Cheers.
     
    Last edited: Jul 9, 2014
  30. gringo2012

    gringo2012

    Joined:
    Jul 6, 2012
    Posts:
    46
    Hello there. Thanks for the continued developmend of Hotween

    I have a question :)

    Is there any way we can get the length of a spline path in unity units. The length should be calculated for a looped path.

    I am asking this because I am trying to have a train that pulls wagons race a curved looped line.
    The curved path is defined by me. The wagons should all start one after the other and they have varying widths so in order to define the offset between them I need to know the length of the path.

    Thank you
     
  31. Headworker

    Headworker

    Joined:
    Sep 6, 2012
    Posts:
    28
    Hey Izitmee,

    Thanks for this super nice plugin!

    I have one question: Im using PlugVector3Path in a top-down-setup and my gameobject keeps turning around at the beginning and goes sideways through the path.

    Things ive tried so far: .Is2D(), locking an Axis.

    Thanks again for the plugin!

    EDIT: NVM, i solved the problem by pareting my object to an empty GO and hack the rotation that way.
     
    Last edited: Jul 11, 2014
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Agh!!!!! Sorry, I just came here to make an announcement and found all these latest posts I didn't answer. My mail notifications were broken by the new forum, but alerts seemed to work, while apparently they're not working correctly either *_*

    Here come the answers, and thank you all for the thankyous :)

    @StrawberryDaddy You can't have more than one tween running on the same property at the same time. Start and end value are taken only once when the tween starts, and the tweens work accordingly

    @hexdump Amplitude is used only by the Back and Elastic eases. I didn't understand the other question though, can you tell me more? I suppose Rewind is not what you need either. Consider also that you can do myTween.Goto(timePosition), and it will go there immediately, so then you can check its value and kill it. Did I get it?

    @gringo2012 Mhmm I might be able to add it indeed. Tomorrow I'll take a look.

    @Headworker Glad you solved it. Consider also that Is2D has an optional parameter with which you can tell HOTween if you want your target to be considered as top-down or side-scrolling
     
  33. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    And now, the announcement :)

    After a load of tests and prototypes to create the best possible engine with what I had in mind, these last weeks I've been working hard on the final version of HOTween v2, which will be called DOTween and is a completely new engine rebuilt from the ground up.

    As of now, I just need to fully implement its version of Sequences, but I can already say that it's way way more efficient and performant than HOTween (and will offer many new features). Also, it will be widely compatible, so no more HOTween and HOTweenMicro separate versions. @Dmitriy Yukhanov (which I respect immensely, and always recommend his Anti-Cheat Toolkit and Advanced FPS Counter) is kindly helping me with feedback and testing.

    Here is a GIF with a sneak peek of DOTween tweening strings in multiple ways, including a "scramble" option, just for fun.

    stringTweens.gif

    (if you can't see it, here's a website version)
     
    Last edited: Jul 14, 2014
    codestage likes this.
  34. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi!,

    @hexdump Amplitude is used only by the Back and Elastic eases. I didn't understand the other question though, can you tell me more? I suppose Rewind is not what you need either. Consider also that you can do myTween.Goto(timePosition), and it will go there immediately, so then you can check its value and kill it. Did I get it?

    I knew the goto command the problem is that sometimes I need this initial value to do things on my own so I can't get it and don't want to cach it in another place (bugs :p). The GoTo command or Reset don't help here because I think I they will play on next HotWeen update and I need them now (when I make the call).

    P.D. I'm really excited about DotTween. Thanks a lot for all your help and effort. You really deserv it!.

    Cheers.
     
  35. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @gringo2012 Grab the latest version of HOTween from the website. I just updated it, and now Tweeners have a GetPathLength method, which returns the length of a PlugVector3Path (if present, otherwise -1). One warning: a path length is not a perfectly precise value (because path lengths, at least for curved paths, are calculated using a sort of "path resolution" algorithm), but still it's precise enough.

    @hexdump Nono, Goto/Rewind happens immediately, not in the next Update. So you can call it, and in the line immediately below check for the new value :) For example:
    Code (csharp):
    1.  
    2. void Start()
    3. {
    4.   // Let's say transform.position is currently 0,0,0
    5.   myTween = HOTween.To(transform, 1, "position", new Vector3(10,10,10));
    6.   myTween.GoTo(0.5f);
    7.   Debug.Log(transform.position);
    8.   // Logs 5,5,5
    9. }
    10.  
     
  36. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Oh, thanks again. Gonna check it :).

    Edit: Sorry to be so picky but I must say that for me this don't work as intended for Shakes. When I call GoTo(0) in a shake tween it doesn't return initial position (position of the transform at the start of the tween).

    Code (csharp):
    1.  
    2. //This is the tween
    3. _shakingAllTopUIBarTween=HOTween.Shake(_t,1.0f,new TweenParms().Prop("position", new Vector3(20, 20, 0), true),2.0f);
    4.  
    5. //When I do
    6. _shakingAllTOpUIBartTween.Goto(0);
    7.  
    8. //t is not where it was when I started the tween
    9.  

    Cheers.
     
    Last edited: Jul 15, 2014
  37. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Why isn't Reverse working for me? It just freezes the rotation for me.

    Code (csharp):
    1.  
    2. protected Tweener tween;
    3. parms = new TweenParms();
    4. parms.Prop("rotation", new Vector3(0, 0, 1));
    5. parms.Loops(-1, LoopType.Incremental);
    6. parms.UpdateType(UpdateType.LateUpdate);
    7.  
    8. tween = HOTween.To(gameObject.transform, rotationTime, parms);
    9. if (counterclockwiseRotation)
    10. {
    11.      tween.Reverse();
    12. }
    13.  
     
  38. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @hexdump Mhmm if it doesn't that's a bug, ouch. Gonna check it out later or tomorrow

    @wightwhale I'll test it later or tomorrow to see what's going on. I assume you're calling Reverse after the tween has played for a while?
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @wightwhale I tested Reverse with a tween identical to the one you posted, and everything works perfectly here. Let me know the answer to the previous question, and eventually post a barebone package that reproduces the issue so I can see if you're doing something wrong

    @hexdump Checking your issue now :)
     
  40. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @hedump Replicates your issue, and sorry, I could've answered before but I forgot how Shake works (ok I'm embarrassed). Shake is actually a special From tween, so when at position 0 the shaken target is actually at its max amplitude, and that's where you're correctly taken by GoTo(0).
     
  41. ultranol

    ultranol

    Joined:
    Apr 1, 2014
    Posts:
    10
    Hi,

    I'm using the latest HOTween from the Asset Store, and the latest Playmaker and relevant playmaker actions.

    I have the following problem though;

    --
    So I've got my Camera's FOV at 73, and I want to tween it over a couple of seconds to FOV 61.

    I'm using HOTween to tween a float between those two values, and on the same state I'm using a Set Property (every frame) to update the FOV.

    It works, however when doing this for the first time after loading the scene, for 1 frame the FOV is set to 0 and I get an error, and the camera obviously appears through the scenery.

    (Screen position out of view frustum (screen pos 152.000000, 330.000000) (Camera rect 0 0 816 459)
    UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)​

    I've tried the different options, like Update/Late Update/Fixed Update, but it always sets it to 0 before the values I actually want!

    I've checked before pressing my button, and the FOV target/start floats are correct. It just goes 0-73....tweening to 61.

    If I then zoom back out (similar action, just with the Start/End values switched), and then zoom in again - there's no 0 used. And it works perfectly.

    It only does this on first attempt after loading the scene. After it's happened, I can zoom in/out repeatedly with the FOV settings being within the correct 61-73 range every time. And most irritating is that I can see my float is 73 way before I actually attempt to zoom.

    I've replaced the HOTween actions with a simple Float Interpolate, using the same values - and it works perfectly, even from freshly loading the scene. No setting the FOV to 0 at all.

    I also get the same problem using a HOTween Vector3 action to set the scale of an object, when triggered it also sets the scale to 0 for a frame, and my object disappears and then reappears before scaling as desired.
     
  42. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @ultranol I have no idea how Playmaker interacts with HOTween, but I can assure you that if your tween starts from 0, even if the tweened property was not set to 0, it's not a HOTween error. The tween engine works like this:
    • When the tween starts, the current value of the object to tween is stored as a start value
    • Then the tween plays to the endValue you set manually or via script
    From your description, the thing that comes to my mind is that you start the tween right at the start of the scene, and since at that moment the FOV is 0 than that value is taken as the starting point and used throughout the whole tween. You could solve this by waiting one frame before starting the tween (or just adding a Delay to it).
     
  43. ultranol

    ultranol

    Joined:
    Apr 1, 2014
    Posts:
    10
    Thanks for the quick reply.

    It's not that I'm tweening right at the start of my scene. I'm loading the scene, and then I could leave it for several minutes - but then the first time I tween the FOV, it sets to 0 for one frame. And it only happens this first time, if I tween to zoom out it's fine, and if I tween to zoom in it's fine then too.

    Since I've tested this by simply swapping the HOTween Float with a Float Interpolate action (that does exactly the same thing), and it's not reproduceable - it has to be either HOTween or the HOTween Float action.
     
  44. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    So it appears that the reverse only goes one time, it doesn't take into account an endless loop.
     
  45. flyingaudio

    flyingaudio

    Joined:
    Dec 3, 2010
    Posts:
    98
    Testing out HOTween, and trying to make HOPath work HOTweenComponent, but I an not finding a way. Is that possible?
     
    Last edited: Jul 16, 2014
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @ultranol Can you send me a barebone example that reproduces this issue? I'm still not convinced it's HOTween's fault (not because I want to be a smartass, but because I can't reproduce it and also because float interpolation - Mathf.Lerp I suppose - works very differently: the start and end value are passed at each update, instead than being taken from the current object's value when a tween starts up). I own Playmaker (even if I still didn't use it), so you can eventually include it (but send the project via PM in that case)

    @wightwhale I can't reproduce that either. Here Reverse works perfectly even with infinite loops, so I would still need a barebone project to test in order to see if you're doing something wrong or there's a bug somewhere

    @flyingaudio No idea about HOPath and HOTweenCOmponent, sorry. I didn't develop HOPath so I wouldn't know. Hope someone else will know how to answer
     
    Last edited: Jul 16, 2014
  47. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    81
    Hi I have a question...

    I have 4 ngui UILabel and I want to tween integer value for each. Ideally I would like to use the same callback and pass the UILables as params. Then in the update, the label (sent as a param) would set its own value. Can I get the new value from the TweenEvent?

    The alternatives are using 4 different callbacks, not ideal. Or having a swich in the callback that cheacks against the label send as a param and set it to whatever value it needs to be.

    How would people achieve this?

    Also when/where can I get DoTween?
     
  48. ultranol

    ultranol

    Joined:
    Apr 1, 2014
    Posts:
    10
    Hi again,

    Found out that it was a problem with the PlayMaker action, not the engine itself. The author has now fixed it.

    Thanks,
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @aholla Sure, you can pass the label as a parameter, and then get its value, like this (I don't use/know NGUI, so I'll use some stub code):
    Code (csharp):
    1.  
    2. HOTween.To(myLabel, 1, new TweenParms()
    3.   .Prop("someProperty", someValue)
    4.   .OnComplete(CallbackFunction, myLabel)
    5. );
    6. // Then you can place this function wherever you want, and you'll have your label
    7. // (but you'll need to cast it as UILabel to use its members)
    8. CallbackFunction(TweenEvent e)
    9. {
    10.   // Logs your label function
    11.   Debug.Log(((UILabel)(e.parms[0])).value);
    12. }
    13.  
    About DOTween, I'm working on it, currently implementing its version of Sequences. I hope to have a beta ready for the end of next week, but I really can't tell for sure and it might take longer.

    @ultranol Glad it was solved :)
     
  50. dixitalgorismi

    dixitalgorismi

    Joined:
    Aug 6, 2013
    Posts:
    30
    Hi Izitmee,

    I'm using your library to smooth move a transform (car) based on data I recorded into a XML file. What I do is manually record waypoints by driving the car while writing datapoints every x seconds (0.1s) through a coroutine to XML and later feeding it into Hotween with something like this:

    mySequence.Append(HOTween.To(transform, interval, newTweenParms().Prop("position", targetPos).Prop("rotation", targetRot.eulerAngles).UpdateType(UpdateType.FixedUpdate).Ease(EaseType.Linear)));

    It's smooth (what I did not manage with lerping and update/LateUpdate/FixedUpdate etc.) but eventhough the interval parameter is the same as when I recorded (0.1) the transform moves much faster. The movement itself is proportionally correct, just too fast. If I manually tweak the interval value to something like 0.128, it's not too fast anymore but starts to stutter a bit. Do you have a idea what's causing this? I hope you understand what my problem is :D