johnatm / itween

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

ignoretimeScale doesn't work with Mathf.SmoothDamp #97

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. change Time.timescale = 0    

2. use the function :
   iTween.MoveTo(gameObject, iTween.Hash(
                "path", ***, 
            "looktarget", ***,
            "looktime", 0.04f, 
                "ignoretimescale", true
        ));
3.

What is the expected output? What do you see instead?

  the camera should be look at target.
  but I see it just move along the path, but do not rotation to look target. "ignoretimescale" cause this problem

What version of the product are you using? On what operating system?

 I use iTween_2_0_45,C#.

Please provide any additional information below.

    I look up the source code, and I find the problem is that the program use the function "Mathf.SmoothDampAngle()" in many place, like "LookUpdate()" function in line 5347.
    Mathf.SmoothDampAngle() has a params "deltatime" and the default value of it is "Time.deltatime", Time.deltatime doesn't work when timescale=0.
    So we should change the params deltatime's value to realtimedelta.
    There are about 20 calls of function "Mathf.SmoothDamp()", I think we should replace them all.

Original issue reported on code.google.com by kil...@gmail.com on 6 Dec 2011 at 7:49

GoogleCodeExporter commented 8 years ago
I just do these in iTween, and then I fixed the bug.

1. Add a private static value : realDeltaTime.
2. Update realDeltaTime in function "UpdatePercentage()".
3. Change the call of "Mathf.SmoothDampAngle()" like this.
Mathf.SmoothDampAngle(vector3s[0].z, vector3s[1].z, ref vector3s[2].z, 
time, Mathf.Infinity, realDeltaTime);

    but I don't know about use private static to do this will add some bug when there are many iTween object or not.
    Looking forward to your reply.Thanks.

Original comment by kil...@gmail.com on 6 Dec 2011 at 8:45