Explorar o código

fix for Animatable.goToFrame

Adam Bowman %!s(int64=8) %!d(string=hai) anos
pai
achega
d92532db89
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      src/Animations/babylon.animatable.ts

+ 8 - 0
src/Animations/babylon.animatable.ts

@@ -74,6 +74,14 @@
         public goToFrame(frame: number): void {
             var animations = this._animations;
 
+            if (animations[0]) {
+                var fps = animations[0].framePerSecond;
+                var currentFrame = animations[0].currentFrame;
+                var adjustTime = frame - currentFrame;
+                var delay = adjustTime * 1000 / fps;
+                this._localDelayOffset -= delay;
+            }
+
             for (var index = 0; index < animations.length; index++) {
                 animations[index].goToFrame(frame);
             }