Skip to content

Patch to fix some issues in shake and start delay #146

@GoogleCodeExporter

Description

@GoogleCodeExporter
This patch fixes two issues

- Shake used global position instead of localPosition even when local flag was 
given as hash argument
- delay was not working when real time was used instead of scaled time

--- a/Assets/Scripts/Lib/iTween.cs
+++ b/Assets/Scripts/Lib/iTween.cs
@@ -3863,9 +3863,13 @@ public class iTween : MonoBehaviour{

                //grab starting rotation:
                vector3s[3] = transform.eulerAngles;
-
+
                //root:
-               vector3s[0]=transform.position;
+               if(isLocal) {
+                       vector3s[0]=transform.localPosition;
+               } else {
+                       vector3s[0]=transform.position;
+               }

                //amount:
                if (tweenArguments.Contains("amount")) {
@@ -4583,7 +4587,17 @@ public class iTween : MonoBehaviour{

        IEnumerator TweenDelay(){
                delayStarted = Time.time;
-               yield return new WaitForSeconds (delay);
+               if(useRealTime) {
+                       var when = Time.realtimeSinceStartup + delay;
+                       while (Time.realtimeSinceStartup < when) {
+                               yield return null;
+                       }
+                       lastRealTime = Time.realtimeSinceStartup;
+               } else {
+                       yield return new WaitForSeconds (delay);
+               }
+
+               //yield return new WaitForSeconds (delay);
                if(wasPaused){
                        wasPaused=false;
                        TweenStart();

Original issue reported on code.google.com by te...@gamesmademe.com on 15 Dec 2014 at 1:02

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions