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.
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
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
Sorry for the long delay. The bug was systemic You can track here:
master ← alexchuber:babylon-loader-non-unique-animations
opened 07:44PM - 29 Jan 26 UTC
Fixes https://forum.babylonjs.com/t/multiple-gltf-characters-serialization-and-l… oading-bug/62013/9. See [this broken playground](https://playground.babylonjs.com/#KSGDML#10) for reference and note the missing links between animations, skeletons, and nodes.
### Changes
- Serialize uniqueId for:
- Skeletons
- Morph Targets
- Use uniqueId to connect:
- AnimationGroups' targetedAnimations -> Nodes or Morph Targets
- Bones -> TransformNodes
- Meshes -> Skeletons
- When connecting things, if no uniqueId is present OR it has no match in the same file, fall back to default behaviors (usually, searching the scene by id instead)
- Treat bones like nodes (which they are :) ) throughout the loader
2 Likes