Przeglądaj źródła

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

Sebastien Vandenberghe 8 lat temu
rodzic
commit
a313e2095e

+ 3 - 0
loaders/src/glTF/1.0/babylon.glTFLoader.ts

@@ -523,6 +523,9 @@ module BABYLON.GLTF1 {
                 }
 
                 var children = joint.children;
+                if (!children) {
+                    continue;
+                }
                 foundBone = false;
 
                 for (var k = 0; k < children.length; k++) {

+ 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);
+                }
             }
         }