Really basic question - why is mesh.skeleton null on load? How are you supposed to know which of the array of skeletons belongs to that mesh?
mesh.skeleton is null, it means this mesh has no skeleton applied. Skeletons are orthogonal to meshes, meshes don’t “own” skeletons. You can find all the skeletons in
scene.skeletons an apply any of these skeletons to any mesh (of course, if the mesh is not compatible with the skeleton, the rendering will be screwed up).
Would add that since you mentioned the word “load”, am making an assumption you might have an export where the skeleton did not come through. In both the major formats used here, .babylon & .glb, if there was a skeleton, it would both be loaded and associated with the mesh(es) which the export dictated.
This is really well debugged. If you think you are missing this assignment, you probably need look in the system, which produced the file. Since .babylon format is a text / JSON file it is much easier look / search for the term “skeleton”.
The context is that I’m trying to clone a mesh and a skeleton. The mesh has a skeleton and animates, but mesh.skeleton is null.
This is taking place long after the loading phase, but I mostly debug during load in any case which led to this question.
It seems weird to me that I can pull a mesh from the scene and I can’t see what skeleton it’s using.
We’re only ever using .glb, although I’m starting to wonder if we’d have less difficulty with .babylon.
This is indeed really strange and a quick repro in the playground would help us addressing the issue in no time.
If a mesh has a skeleton and animates, it’s not possible (at least I don’t think it is possible) that its
mesh.skeleton property is null. Are you sure it’s not a morph animation instead?