How to add mesh inside skinned mesh so that it moves when skinned mesh moves in animation?


I am trying to reproduce the behaviour as in this video. I will add circle tags to a model upon double clicking the model. I use raycasting for this purpose to add it at the right spot. It works fine normally. But for animation it is not moving along with the skinned mesh. i tried adding the tags inside skinned mesh but it is not working.

This post might be helpful:

Often you want the annotation to be HTML rather than a mesh, in which case you just compute its position each frame. If you did use a mesh, and want it pinned to a part of the SkinnedMesh, you probably want to make it a child of a Bone, not of the SkinnedMesh, to follow that Bone.

Annotations as a html will not work for my case. how can I find the bone which will affect the vertices found via raycasting?

If you have the vertex index, look up the geometry.attributes.skinIndex and geometry.attributes.skinWeights. The first contains indices (order in mesh.skeleton.bones) and the second contains weights [0,1] for up to four bones affecting the vertex. SkinnedMesh docs have more on this.

Thanks it is working