AssetContainer animation group clone broken in Babylonv5

https://playground.babylonjs.com/#IJ5DL6#28

Here i load a tpose model through asset container and then instantiate it, and then try to load and clone the animation groups from another asset container.

This used to work in 4.2 but now is broken.

Switch between 4.2 and 5 to see

Any recommendations for fix?

@Evgeni_Popov might have a brillant idea ?

I don’t quite know why it works in 4.2 because an animation loaded from a gltf/glb file must update the transform nodes, not the bones. So you should modify return avatar.skeletons[0].bones[idx]; to return avatar.skeletons[0].bones[idx].getTransformNode();:

https://playground.babylonjs.com/#IJ5DL6#30

2 Likes

Amazing thank you! I don’t know why it worked before either, i thought the bones were transformnodes already? but looks like you need to get the node.

No, bones are not transform nodes (they inherit from Node, not TransformNode).

When loading a gltf/glb file, each bone of a skeleton is linked to a TransformNode (bone.getTransformNode() returns a non-null value) and it is this TransformNode which is animated, not the bone (but the bone still gets updated by the TransformNode matrix to mirror the transformation).

1 Like

phenomenal cheers

1 Like