Animation Groups Not working

a playground is a great idea. i made a real simple example of my issue https://playground.babylonjs.com/#AJA5J6#68

on line 29/30 i can control the animations of player 1 but cannot control player 2

i’ve experienced the same problem. firstly the animationGroup works ok, the problem is the animation data is not inside the mesh. it is somewhere else. the bones are assigned to animations via animation target. so in teory, animation group should be cloned and retargeted as well to be able to play them seperately on every instances (correct me if i’m wrong). lets say you have something that has 25 bones and 20 animations, in my oppinion all of these gives too much complication.

a easier but dirtier solution solution is to call the importMesh for each player. rename the animation groups on each import . for example

SceneLoader.ImportMesh(…some awesome mesh …);
// loop all animation and rename
animation = scene.getAnimationGroupByName(“animation”);
animation.name = “player1_animation”;
animation.start( loop, speed, animation.from, animation.to, additive);
// or
scene.getAnimationGroupByName(“player1_animation”).start( loop, speed, animation.from, animation.to, additive);

yep. that’s what i’m doing. but it’s pretty dumb considering you make multiple network calls to load the same model

There is much simpler way - https://playground.babylonjs.com/#AJA5J6#76
Cloned models plays different animation.

doesn’t work, just throws an error Error in onSuccess callback (Cannot set property skeleton of [object Object] which has only a getter)

It works in 4.2


(seems for 5.0 it is a kind of bug)

See my answer here:

3 Likes