فهرست منبع

Merge pull request #2367 from bghgary/animation-fix

Start all animations instead of just the first
David Catuhe 8 سال پیش
والد
کامیت
805f35be74
1فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 7 5
      loaders/src/glTF/2.0/babylon.glTFLoader.ts

+ 7 - 5
loaders/src/glTF/2.0/babylon.glTFLoader.ts

@@ -82,7 +82,7 @@ module BABYLON.GLTF2 {
 
             this._onLoaded = () => {
                 this._showMeshes();
-                this._startFirstAnimation();
+                this._startAnimations();
 
                 if (this._errors.length === 0) {
                     onSuccess();
@@ -134,15 +134,17 @@ module BABYLON.GLTF2 {
             }
         }
 
-        private _startFirstAnimation(): void {
+        private _startAnimations(): void {
             var animations = this._gltf.animations;
             if (!animations) {
                 return;
             }
 
-            var animation = animations[0];
-            for (var i = 0; i < animation.targets.length; i++) {
-                this._babylonScene.beginAnimation(animation.targets[i], 0, Number.MAX_VALUE, true);
+            for (var i = 0; i < animations.length; i++) {
+                var animation = animations[i];
+                for (var j = 0; j < animation.targets.length; j++) {
+                    this._babylonScene.beginAnimation(animation.targets[j], 0, Number.MAX_VALUE, true);
+                }
             }
         }