How to calculate bones in relation to the mesh they influence

When I morph my figure the skeleton does not morph with the model. How do I calculate the bones in relation to the mesh they influence so i can scale the skeleton to match the mesh? Also the eyes and teeth do not move with the mesh. Are these bound to the skeleton and when it moves will they move with it? I need advice in what the best approach will be to accomplish my goals. Thanks!

I’m not asking anyone to write the code for me… I just need a general direction. If I try to manipulate the bones position I end up influencing the morphed mesh.

Each SkinnedMesh geometry must contain a joints attribute, with the indices of bones that influence each vertex, and a weights attribute, with the weights (0-1) for each of those bones. It’s unusual to construct the skin/rig with code, particularly for a complex humanoid skeleton… You might want to set this up in Blender and then export it, instead. Also ensure that your materials have skinning enabled.

Thanks Don… the mesh was setup in Blender and the skeleton is a working skeleton. I exported it as gltf and imported it using the GltfLoader. However, when a morph changes the dimension of the model the skeleton does not morph with it. I could forgo allow changing the dimension of the model outside of the skeleton but that would make it less useful. What I am looking for is some way to adjust the skeleton with the morph so that it stays proportionally with the morphed mesh. Any thoughts on this?

How would I get the associated bones for each vertex and their weights?
I would think that if I knew the vertex associated with each bone I could track the location of the changed vertex and reassign the bone to the new location.

All in all that sounds pretty complicated. A vertex may be (and probably is) affected both by multiple morph targets and multiple bones, possibly at the same time. But in any case, the mapping is stored in the skinIndex and skinWeights attributes on the geometry. See SkinnedMesh.boneTransform for an example of accessing that data. It calculates the position of the vertex at the given index, based on the 1-4 bones that may influence that vertex. The method is used for raycasting — during rendering that calculation would happen on the GPU.

Thank you sir… as usual you are always helpful. Thank you for your time. ?;O)