johnatm / itween

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

ignoretimescale boolean ignored on MoveTo functions #70

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Trigger a MoveTo tween with the ignoretimescale hash set to true.
2. Alter the game's timescale.
3. The MoveTo tween is still updated based on the timescale.

What is the expected output? What do you see instead?
The expected result is to have a smooth, consistent tween when ignoretimescale 
is true and the timescale is changed. In the most common scenario I am setting 
the timescale to 0 and seeing the tweens pause as well as the rest of the game.

What version of the product are you using? On what operating system?
I am using the current version available on the Unity asset store as of 
5/30/11. OS is Win7 64-bit.

Please provide any additional information below.
I see the correct results with some other tween types I've tried (ie ValueTo).

Original issue reported on code.google.com by tatsus...@gmail.com on 31 May 2011 at 5:12

GoogleCodeExporter commented 8 years ago
I've since realized that this only occurs when the object has a rigidbody. As a 
workaround I've begun running a tween only on child meshes when the timescale 
is zero.

Original comment by tatsus...@gmail.com on 12 Nov 2011 at 7:55

GoogleCodeExporter commented 8 years ago
I ran into this same problem.  I may have a fix for iTween not moving the 
gameObject.

The root of the problem is that when a gameObject has a rigidBody then iTween 
does the correct thing and updates the rigidbody in FixedUpdate and uses 
RigidBody move methods.  However when the timescale is set to 0 then physics is 
disabled so all calls to FixedUpdate stop and any calls to RigidBody move 
methods don't happen.

So I added another bool to keep track of if Physics is enabled globally and if 
not then ignore the rigidbody on the gameobject.

In Update() I added
    if (Time.timeScale == 0f && useRealTime)
    {
        physics = false;
    }
and in FixedUpdate I added
    if (tryToUsePhysics)
    {
        physics = true;
    }
and init'd the tryToUsePhysics in the RetrieveArgs call.

This way my objects move regardless if phsyics is enabled or not (and continue 
to move if physics is enabled/disabled during the move).

Original comment by pco...@gmail.com on 1 Apr 2013 at 10:44