How can I add a skeleton to an OBJ file and then export it as a GLTF file?

Let me describe the progress made so far:

  1. Imported an object using MTL loader and OBJ loader.
  2. Created SkinnedMesh using children[0].geometry from the object and the material results from the MTL loader.
  3. Generated skeleton data and bound it to SkinnedMesh.

Up to this point, the process has been successful. However, when I try to do object.add(skinnedMesh), it fails, saying there is no data for skinIndex, skinWeight, or matrixWorld.

How can I include the skeleton in the export to a GLTF file?

OBJ doesn’t contain the skinning weights for vertices to bones, so you can’t just take any mesh and mash it onto a skeleton. You can attach the mesh to a single bone… or compute vertex weights yourself somehow (hard).