# Get Animation from Animation Group

**URL:** <https://forum.babylonjs.com/t/get-animation-from-animation-group/27868>\
**Category:** Questions\
**Tags:** animation, rigged, animation-event\
**Created:** [February 22, 2022, 12:07am UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868 "2022-02-22T00:07:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [February 22, 2022, 12:07am UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/1 "2022-02-22T00:07:09Z")

</div>

I’m trying to test out a few animation features like animation events and grouping animations using rigged characters but having trouble understanding how to reference the animation data properly. I’ve provided a playground here: [https://playground.babylonjs.com/#YAL1RN#26](https://playground.babylonjs.com/#YAL1RN#26) that includes a rigged character with two separate animations.

The animations were organized using the Non-Linear Animation tool within Blender. I’d like to be able to control a few rigged characters in a scene using an animation group to start/stop their animations based on events within the game. For events this would involve having a character playing an attack animation and the enemy playing their death animation at a specific point using animation events.

Can anyone explain how I can reference the individual animations of a character like this so that they can be used with animation events and grouping?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 22, 2022, 11:07am UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/2 "2022-02-22T11:07:47Z")

</div>

Hello! Sorry, I don’t think I fully understood the question 😅 You want to be able to select the animations as “death” or “attack” instead of indexing on the animation arrays? If so, you can use [getAnimationGroupByName](https://doc.babylonjs.com/typedoc/classes/babylon.scene#getanimationgroupbyname) on the scene. This is your playground using these functions: [glTF Loader Demo | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#YAL1RN#27)

---

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [February 22, 2022, 6:14pm UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/3 "2022-02-22T18:14:17Z")

</div>

Let me clarify, how would I use animation events with the rigged character in the playground? Let’s say at frame 60 within the “scream” animation I would want to call a function. Here is an updated playground of my attempt at creating an event and trying to display a console message at frame 60:

> **[Babylon.js Playground](https://playground.babylonjs.com/#YAL1RN%2329)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

It seems like I might have the animation of ‘scream’ that I can add the event to, but nothing appears in the console. So I’m not sure if the way of referencing this animation is incorrect, or if there’s an issue with how the event is created/added.

---

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [March 2, 2022, 4:42pm UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/4 "2022-03-02T16:42:45Z")

</div>

Is there no way to use animation events with imported animations like the one in my playground above? I know I can time it myself, but I’d like to use the built-in animation events if possible.

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [March 2, 2022, 6:30pm UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/5 "2022-03-02T18:30:17Z")

</div>

It works if you start the animation after the event is added like below. 🙂

> **[Babylon.js Playground](https://playground.babylonjs.com/#YAL1RN%2334)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [March 2, 2022, 7:01pm UTC](https://forum.babylonjs.com/t/get-animation-from-animation-group/27868/6 "2022-03-02T19:01:05Z")

</div>

Well, that was simple enough, thank you!
