diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index b10a7425804b00..d784d811117241 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -3776,6 +3776,7 @@ class GLTFParser { const json = this.json; const animationDef = json.animations[ animationIndex ]; + const animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex; const pendingNodes = []; const pendingInputAccessors = []; @@ -3792,6 +3793,8 @@ class GLTFParser { const input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input; const output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output; + if ( target.node === undefined ) continue; + pendingNodes.push( this.getDependency( 'node', name ) ); pendingInputAccessors.push( this.getDependency( 'accessor', input ) ); pendingOutputAccessors.push( this.getDependency( 'accessor', output ) ); @@ -3929,9 +3932,7 @@ class GLTFParser { } - const name = animationDef.name ? animationDef.name : 'animation_' + animationIndex; - - return new AnimationClip( name, undefined, tracks ); + return new AnimationClip( animationName, undefined, tracks ); } );