Building skeleton from exported armature and binding to skinned mesh

I am trying to export an armature from blender as an FBX file and then constructing a skeleton out of it once loaded using the FBXLoader. Then, I want to merge it with a skinned mesh character. My goal is to have different models and different poses and to just be able to mix and match between them.

I attempted to create a codepen of it here: https://codepen.io/michael-tipton/pen/mGvvQr?editors=0011
but the fbxloader isn’t pulling the files from dropbox. Unsure how to proceed there.

My main function for creating the bones is as follows:

function createBones( root , array ) {
            if(root === null && root === undefined ) {
              return;
            } else {
              let bone = new THREE.Bone();

              bone.position.set( root.position.x, root.position.y, root.position.z );
              bone.name = root.name;
              bone.setRotationFromQuaternion( root.quaternion );
              bone.scale.set( root.scale.x, root.scale.y, root.scale.z );
              if(root.parent !== null && root.parent !== undefined ) {
                  bone.parent = root.parent;
              }
              array.push(bone);

              for(let i = 0, count = root.children.length; i < count; i++) {
                  createBones(root.children[i], array);
              }
              return;
            }
        }

I’m having a hard time figuring out how to go about troubleshooting. I attempted to use skeletonhelper but the armature is so warped and different than the model (and also extremely small) that it isn’t particularly helpful in letting me know what is going on.

I’m not sure if the armature isn’t loading correctly or if I’m not recreating the skeleton correctly, or if it is something else. When I tried applying some sort of movement to the armature, the skinnedmesh didn’t move at all.

Does anyone have experience with troubleshooting these types of issues or have any ideas how I can get insight into what is going on? Thanks and 1 million karma credits to you for reading this!

Crosspost:

One way to solve this problem is to put your resources into a github repo and then use an URL like the following:

https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/models/collada/elf/elf.dae

The structure of the path is:

/username/repository/branch/path/to/your/file.fbx

1 Like

I’ll do this when I get home from work today. Thanks!

I’ve abandoned using the FBX file format. Switched to GLTF with excellent results.

1 Like