# Empty animations array when importing GLB model

**URL:** <https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649>\
**Category:** Questions\
**Tags:** glb, animation\
**Created:** [December 14, 2021, 3:07am UTC](https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649 "2021-12-14T03:07:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcy](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jcy](https://discourse.threejs.org/u/jcy)\
**Post date:** [December 14, 2021, 3:07am UTC](https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649/1 "2021-12-14T03:07:52Z")

</div>

Hi,

Previously when I imported FBX models and try to play it’s animations, I simply had to loop through it’s animation array like this:

```javascript
   setModelAnimation(object, clipName, model_repeat) {
        this.mixer = new this.context.three.AnimationMixer(object);
        this.clipAction = this.mixer.clipAction(this.context.three.AnimationClip.findByName(this.findAnimations(object), clipName));
        this.clipAction.play();
        
        if (model_repeat == false) {
            this.clipAction.clampWhenFinished = true;
            this.clipAction.repetitions = false;
        }
    }
    
    findAnimations(object) {
        const animations = new Array();
        object.traverse(obj => {
            if (obj.animations) {
                obj.animations.forEach(anim => animations.push(anim));
            }
        });
        return animations;
    }

```

However now when I import the same model but in GLB format, the animation array is empty for some reason. But I’m able to play this model’s animations here:

> **[Creators 3D - Jobs for Professional Artists](https://www.creators3d.com/online-viewer)**

The GLB and FBX model can be downloaded here:

> **[model.fbx and 1 more file](https://wetransfer.com/downloads/10d7a8b9a6750f7935653aab05dc254020211214030701/14ea55)**
>
> 2 files sent via WeTransfer, the simplest way to send your files around the world

Can someone please tell me how can I play GLB model animations in Three JS if the animations array is empty?

Thanks!

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [December 14, 2021, 4:33am UTC](https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649/2 "2021-12-14T04:33:38Z")

</div>

When loading a glTF object, the animations are not attached to a Scene or Group object – they’re in an array called `.animations` in the response object from GLTFLoader. See the [glTF documentation](https://threejs.org/docs/#examples/en/loaders/GLTFLoader), or the source code for [this example](https://threejs.org/examples/#webgl_animation_keyframes).

---

<div class="post-metadata">

**Author:** ![jcy](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jcy](https://discourse.threejs.org/u/jcy)\
**Post date:** [December 14, 2021, 5:28am UTC](https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649/3 "2021-12-14T05:28:25Z")

</div>

I’m using the Matterport SDK’s included GLTF Loader. Since they also use Three JS as their base, I assumed that their GLTF Loader would function normally like the default loader. This screenshot is what I get returned when I load the GLB model. Is the animations array within this SceneNode object?

 ![Screen Shot 2021-12-14 at 1.25.57 PM](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/3/738b847c1c588b12160dc7b3daad3e3d49fe1c13.png)

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [December 14, 2021, 6:38am UTC](https://discourse.threejs.org/t/empty-animations-array-when-importing-glb-model/32649/4 "2021-12-14T06:38:27Z")

</div>

Hm, I have no idea what that is sorry – it’s not what THREE.GLTFLoader would normally return at all.
