What's the right way to do this?

I have two skinned models with the same skeleton that I want to play the same animation on.

Is it possible to get them to share an animation group and a skeleton? Or do I have to clone the skeleton?

If it’s the latter, what’s the next step after cloning the skeleton? Do you need to clone the animation group as well?

You can reuse the same skeleton:


Does clone() not create a separately processed instance of the skeleton? Looking forward I don’t want to multiply the number of times an animation is processed for a skeleton per item of clothing.

That did work though, thank you. I currently have an asset-loading race condition that ensures it only works about one time in 20 though. I tried calling AssetManager.load() on my parent mesh, then added a new mesh task for the clothing and called load() again but the second load never fires.

Would an asset container be helpful with this?

No, you can see there’s a single skeleton in the scene (there’s no distinction of skeleton/instance of skeleton):

All clones are pointing to the same skeleton Skeleton0.

Hard to tell without a repro… Does it work if you load using SceneLoader.ImportMesh or SceneLoader.Append?

I use AssetManager.addMeshTask() so that we can control when loading takes place, but the result is always random whether it is able to find the original skeleton in the scene. Looking at some stuff with promises to make dependent meshes wait, but queueing dependent meshes on success and calling AssetManager.load() again after that doesn’t do anything.

Importing meshes through the AssetManager.addMeshTask will also load the skeletons (it is using SceneLoader.ImportMesh under the hood), so they should be readily available.

I ultimately solved it by having dependent meshes load inside the MeshTask’s success function as regular SceneLoader.ImportMesh functions. Seems to work well now.

1 Like