# How to run actions contained in the glb using Babylon.js?

**URL:** <https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182>\
**Category:** Questions\
**Created:** [June 10, 2024, 5:25am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182 "2024-06-10T05:25:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PreciousCord03](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@PreciousCord03](https://forum.babylonjs.com/u/PreciousCord03)\
**Post date:** [June 10, 2024, 5:25am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/1 "2024-06-10T05:25:29Z")

</div>

So, I have a .glb file and when I open it in the Sandbox, there is a drop-down list in which about 5 actions are there. But when I open the glb via Babylon.js on a website, only 1st action is being played, on a loop. How can I run all the actions which is in the Blender file(.glb)?

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [June 10, 2024, 7:49am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/2 "2024-06-10T07:49:12Z")

</div>

Hello,

There are several ways.

* * *

For example you can use

```auto
const anim = scene.getAnimationGroupByName("Annimation Name");
anim.start(params)

```

To select an animation and play it at any moment.  
Have a look at this [Playground](https://playground.babylonjs.com/#Z6SWJU#5)

* * *

Also a usefull trigger is :

```auto
anim_0.onAnimationGroupEndObservable.add(function() {
    anim_1.start(params)
})

```

Where you trigger `anim_1` when `anim_0` ends, etc…

* * *

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![PreciousCord03](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@PreciousCord03](https://forum.babylonjs.com/u/PreciousCord03)\
**Post date:** [June 10, 2024, 9:22am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/3 "2024-06-10T09:22:30Z")

</div>

Alright, many thanks. But when I’m playing the 2nd action, 1st action is playing alongside with the 2nd one. Is there a way each animation is played after the previous one ended? Like when 1st ends, 2nd starts.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 9:30am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/4 "2024-06-10T09:30:01Z")

</div>

You can stop the first one using `animationGroup.stop()`, or prevent it from looping by setting `loopAnimation` to be false (on the animation you have referenced)

---

<div class="post-metadata">

**Author:** ![PreciousCord03](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@PreciousCord03](https://forum.babylonjs.com/u/PreciousCord03)\
**Post date:** [June 24, 2024, 6:32am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/5 "2024-06-24T06:32:10Z")

</div>

Thank you so much. It worked!!! And how can I turn off the first animation, like I can switch the isEnabled in the debugLayer and it works but when I click on the “Copy to clipboard” and paste it, it is coming as ‘undefined’. How can I disable the first animation?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 24, 2024, 9:43am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/6 "2024-06-24T09:43:05Z")

</div>

you can call `scene.stopAllAnimations()` on model-loaded to stop any animation running. would that do the job?

---

<div class="post-metadata">

**Author:** ![PreciousCord03](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@PreciousCord03](https://forum.babylonjs.com/u/PreciousCord03)\
**Post date:** [June 24, 2024, 9:47am UTC](https://forum.babylonjs.com/t/how-to-run-actions-contained-in-the-glb-using-babylon-js/51182/7 "2024-06-24T09:47:46Z")

</div>

Ok, so implemented that and working when I don’t need any animations running. And for to disabling the specific animation, I used the scene.getNodeByName(“Animation Name”).setEnabled(false);

Many thanks!!!
