Deep-copy animation?

Having a bit of a problem between distinct character meshes. When they play an animation they synchronise.

The situation is that we load the same mesh separately for different players, then find the animations in the loader’s onSuccess arguments from the incoming animationGroups. They’re never intentionally synchronized.

This is giving me problems when I go to play animations. Either their idle animations are perfectly synchronised all the time (the idle animation is 13 seconds long so that’s obviously syncing) or when I go to play animations on the remote player, even though it’s being fed the values, the animation isn’t playing, possibly because the primary player isn’t playing that animation at the time.

I’ve made a function to brand structures with UUIDs so I can see if they’re being shared by anything, and they all seem to be unique. At the same time, sometimes during the loader’s onSuccess function, an animationGroup coming in as an argument already has a UUID from that process.

What can I do here? Would deep-copying the animation somehow break unwanted references, or is it some other aspect of Babylon causing it?

Edit: I found clone() so I cloned and assigned the skeleton, and cloned and assigned the animation groups.

The code is definitely telling the animations to play, and it’s the exact same code as the main character, and the scalar values are all correct, but the remote player representation still never plays its movement animations. However on reverting to idle it’s no longer in sync with the main player, so that’s something.

It’s going to be difficult to help as obviously playing several / unsynchronized anims are possible in Babylon, it must be a problem in your code.

You should try to repro in the Playground so that we can help.

1 Like

Yeah it’s one of those things where the volume of code is so huge that reproducing the problem is probably impossible. Good call though, I’ll try a simpler example and see if I can get it to work.