Imported glb mesh not cloned

Hello everyone. I need an independent clone of the character, but the clone function that works with meshes from MeshBuilder for some reason does not work with my mesh

You need to duplicate the skeleton and apply it on the new cloned mesh:

1 Like

Yes, it looks like this is the solution to the problem. But I need a slightly more flexible system. Could you help me to do something with the PlayerForCopy object so that the characters are copied like in the commented code?

You can do something like that:

Note that I have renamed mesh to root because this node is not really a mesh per see, it does not have any geometry, it is a node that provides the root transformation matrix.

Also, I don’t think you need to clone the animations, but if you need you have a clone method that you can use on AnimationGroup.

1 Like

Thank you, you explained very well. If you will, I have one more question, but it is theoretical. The point is that I am porting a 2D application to a 3D space. There is multiplayer. When a new player joins, I load the new Character.glb model using ImportMeshAsync. And this is where the problem occurs because I and another user have the same character from the same Character.glb appearing on stage. BUT! They have different rotationQuaternion. And when the other player moves, I see that his turns are incorrect for me, as for the remote player, but for him on the client, the turns are correct. Why do you think this can happen, why do they have different rotationQuaternion?

It seems to be a problem in the communication layer, the rotation data received by the other player may be wrong? You should try to log what you receive and compare it to what the other sends / the rotationQuaternion of the other player.

1 Like

If between loading the mesh I create something using MeshBuilder, the quarterions change for some reason. And it’s just on the client, without connecting a second playercoords

The last question is no longer relevant. I solved it by dropping all the quarterions when loading the mesh. Then I rotated the mesh, and passed it through the server to rotate them to the euler corners. Thank you for attention