Working with assets in GLTF/GLB format, is it possible to have a file with the 3D model on the one hand, and a file with only the animations (without any geometry in it) on the other.
Both Maya and Blender exporters allow exporting GLTF/GLB animation-only files.
The case is, when importing both files (file 1: model / file 2: animations) in the same BJS scene, although we observe from Inspector the AnimationGroups are all correctly loaded in the hierarchy, and even the channels shown the correct node names, playing the scene no produce any animation. If we export all under a unique file, all works fine with BJS.
Is our approach wrong with the concept of separated Animations from Meshes, and that fail to animate only the expected from the GLTF/GLB standard?
If you clone the animationGroup you can retarget it to animate your model instead of the placeholder nodes. Like below is how I retargeted a flying animation for example.
I’ve just arrived to a similar implementation, but instead of cloning the Animation Group, I update (retarget) the targets of all its channels (aka Targeted Animations):
/*
result: comes from ImportMeshAsync of the only-animation file (that despite its name also import animations)
_targetMesh: target mesh (obviously) we're attaching the animation to
*/
for (var j = 0; j < result.animationGroups[i].targetedAnimations.length; j++) {
result.animationGroups[i].targetedAnimations[j].target = _targetMesh.getChildren()[0];
}
This way I don’t need to dispose the old animation as an extra task, but of course maybe the AnimationsGroup.clone.is more optimized in its code.