Attach animation to the glb from another glb file

To my knowledge, there are atleast two possible ways to do this:

1. animationGroup.clone()-function:

If bone names are identical on both skeletons (else you have to rename), the targetConverter would look similar to this:

(target) => {
     let idx = skeletons1[0].getBoneIndexByName(target.name)
    return skeletons1[0].bones[idx]
}

2. create animationGroup and add animations with targets:

var newAnimationGroup = new BABYLON.AnimationGroup("newGroup");
for (var {target, animation} of importedAnimationGroup.targetedAnimations) {
    newAnimationGroup.addTargetedAnimation(animation, newTarget);
}

Playground of carolhmj:

3 Likes