Multiple gltf characters serialization and loading bug

load two characters with same mesh, skeleton, animations

Export them as babylon file (say using inspector)

load the saved bablyon file.
The animations no longer work

See
https://playground.babylonjs.com/#Z6SWJU#1232

Here the same character is loaded twice.
(The second character should play “samba”. it doesn’t. bug?)

Use the inspector to export the scene as babylon.

load the file into the https://sandbox.babylonjs.com/
Animations no longer work.

@alexchuber

About the 2 anim not playing it is because in the pg, you find the anim by name and both have the same name.

https://playground.babylonjs.com/#QENEH8#1

I ll let @alexchuber look at the serialization issue.

Yes you are right. two anims with same name.
Ofcourse your soln wouldn’t work if result also had anims with the same name, in which case one would have to check each TargetedAnimation of each AnimationGrooup to see if it targeted any node of the character you are trying to animate. Groan!

the issue with serialization is that in each serialized TargetedAnimation , the target is serialized using its name. Node names are not unique. The target should be serialized using its unique id rather than its name.

surprised nobody ran into this issue till now

Hi @alexchuber

any update ont this ?

Will take a look today. Thanks for the report!

2 Likes

The issue was indeed name collisions between the IDs of nodes, bones, and skeletons. (Hey, that’d be a cool band name.)

PR will be up shortly.

2 Likes

ahah

3 Likes

Sorry for the long delay. The bug was systemic :slight_smile: You can track here:

2 Likes