How to accurately add TransformControls to a skeletal model?

I encountered a tricky issue when adding controls to the model. When I click on the model, the selected type is ‘SkinnedMesh’, and only by finding the root node can I move the model properly. However, after moving it, playing the animation causes the model to revert to its original position. I’m unsure how to proceed. I hope someone can help me solve this problem. Thank you.

CleanShot 2024-02-29 at 17.02.22

When you load a skinned mesh (with addon like gltfloader) the animation data is stored at the root of a group object. Wich mean all positions will stay relative to this group object, and not at the mesh level.

In your code, you raycast children of the group, then move the mesh. The animation will “reset” the position, because the group is still at the same coordinates.
To fix this, you need to raycast and move the goup object. This is an additional rule for any skinned mesh using default hierarchy from gltf loader (and for multiple reasons, it’s highly recommended to keep it that way)


Thank you for your reply. I have found the group and added the TransformControls control, which solved the problem. Thank you again.

1 Like