AnimationGroup questions

Hey @Deltakosh, thanks for tips.
I’m trying to summarize. And maybe at the end we’ll add this info to doc.
Please corect me if I’m wrong.

AnimationGroup for gltf/glb files

  1. The only import function which has ‘directly’ acces to animationGroup from your gltf/glb file is importMesh, where the 4th param is animationGroup. For all other functions like Load, Apend, or if we are using taskManager, we can acces it only with scene.animationGroup, or, with scene.getAnimationGroupByName

  2. By default animationGroup is playing. So when we import a model its animations is already playing. We can avoid this using

    BABYLON.SceneLoader.OnPluginActivatedObservable.addOnce(loader => {
    	loader.animationStartMode = BABYLON.GLTFLoaderAnimationStartMode.NONE;
    });
    
  3. We can reverse an animation from animationGroup with speedRatio -1, but we need to specify from and to frames (I tried without :slight_smile:, because of this it didn’t work)

  4. Morptargets are exported as animationGroup, so if we want to play with morph influence in our scene, we have to play with animationGroup to simulate interaction with morph.
    https://www.babylonjs-playground.com/#DS22WT#7

  5. How to add events to animationGroup. Is required to add the even to each animatable from group, but do the action from event only one time, not for all animatable.
    https://www.babylonjs-playground.com/#DS22WT#8

To add.
clone - How to clone a GLB model and play seperate animation on each clone?, - https://github.com/BabylonJS/Babylon.js/issues/5423

1 Like