johnatm / itween

Automatically exported from code.google.com/p/itween
1 stars 2 forks source link

Option to use custom deltaTime, allowing pause menus to use iTween #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think it would be a great option to allow using deltaTime as calculated 
inside the iTween script off of Time.realtimeSinceStartup to allow pause menus 
to use iTween for animations.

Original issue reported on code.google.com by johaga...@gmail.com on 9 Sep 2010 at 10:36

GoogleCodeExporter commented 8 years ago
Ack, I didn't see an option to change the type. Sorry about that :/

Original comment by johaga...@gmail.com on 9 Sep 2010 at 10:36

GoogleCodeExporter commented 8 years ago
Not sure I understand you on this.  Can you explain some more?

Original comment by pixelplacement on 10 Sep 2010 at 5:50

GoogleCodeExporter commented 8 years ago
Allow the end user to switch between Unity's Time.deltaTime and one calculated 
in the script. This will prevent changes to Time.timeScale stopping the 
functionality of iTween.

Original comment by johaga...@gmail.com on 10 Sep 2010 at 8:14

GoogleCodeExporter commented 8 years ago
Sorry, I want to make sure I understand this 100%... 

Right now iTween actually does its animation in an Update loop the option to 
switch this to FixedUpdate() as well as have everything correctly work on 
Rigidbodies will be available soon.  

How would you propose I alter things to allow timeScale changes to not affect 
iTween's animations?

Thanks!

Original comment by pixelplacement on 11 Sep 2010 at 3:08

GoogleCodeExporter commented 8 years ago
Keep track of the last Time.realtimeSinceStartup, and subtract new time from 
old to get the deltaTime that is unmodified by the timeScale changes.

For example (not tested; off the top of my head):
float lastTime;
float customDeltaTime;
void Update()
{
    customDeltaTime = Time.realtimeSinceStartup - lastTime;
    lastTime = Time.realtimeSinceStartup;
    //Do stuff with the delta time
}

Original comment by johaga...@gmail.com on 11 Sep 2010 at 4:51

GoogleCodeExporter commented 8 years ago
And again, allow this to be optional, as slowing time/pausing time could still 
be very useful.

Original comment by johaga...@gmail.com on 11 Sep 2010 at 4:52

GoogleCodeExporter commented 8 years ago
I'll see about perhaps adding this.  Thanks for the idea.

Original comment by pixelplacement on 11 Sep 2010 at 10:30

GoogleCodeExporter commented 8 years ago
This issue has my vote. I just ran in the same issue that setting 
Time.timeScale to zero will also stop all animations created with iTween. 
Although there are a lot of situations where this is the behaviour you'd 
expect, however there are also situations where you don't want this to happen. 
For example when pausing the game and animating a GUI menu with the option to 
continue playing the game.

Those who want to pause iTween animations should also use iTween.Pause() when 
setting timescale to 0.

Original comment by p...@paultondeur.nl on 17 Sep 2010 at 7:07

GoogleCodeExporter commented 8 years ago
I'm open to code additions if someone wants to tackle this.  Thanks!

Original comment by pixelplacement on 29 Sep 2010 at 11:57

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Added as of 2.0.33

Original comment by pixelplacement on 12 Oct 2010 at 1:58