Dynamically load bvh animation for another model with the same skeleton not work

hi all, i have encounter a problem when i load a bvh animation and set the animationClip for a gltf model,
the bvh animation is exported from blender, and the gltf model is also exported from blender , they are export from the same object.

the image below shows the result


or

the steps which i did is like this:

  1. load a model with animation into blender
  2. export the model using glb format
  3. export bvh
  4. gltfloader load the gltf model into threejs and create mixer
  5. bvhloader load the bvh into threejs and get the clip , mixer.ClipAction(thisClip).play()

this is the rest pose

btw:

  1. if i use the gltf.animations[0], the animation is correct,
  2. or use the fbx.animations[0] (which export from blender the same way), the result is also looks correct.
  3. the animation of skeleton of the bvh is correct

i’m not sure what is happen, looking for your help, thanks

1 Like

I have what seems to be the exact same problem. I’m loading a character from GLTF, then applying the clip from a BVH file, and getting the same exact type of distortion.

First thought that comes to mind is that the UP axis is different for all coordinate and child coordinate systems. For example Z-up instead of Y-up.

What happens if you swap all the Y position values with Z position values in every keyframe track? For example, something like this:

new BVHLoader.load('path/to/file.bvh', (bvh) => {
                const pos = new Vector3()
                const posTracks = bvh.clip.tracks.filter(t => t.name.includes('.position'))

                for (const track of posTracks) {
                    for (let i = 0, l = track.values.length / 3; i < l; i++) {
                        pos.set(
                            track.values[i * 3 + 0], // x
                            track.values[i * 3 + 2], // z
                            track.values[i * 3 + 1], // y
                        )

                        track.values[i * 3 + 0] = pos.x
                        track.values[i * 3 + 1] = pos.y
                        track.values[i * 3 + 2] = pos.z
                    }
                }
})

For me this straightened most of the model out, except my character is bent in half after, plus the animations still don’t work.

If we change the axes for each position, I’m guessing we might also need to change the quaternions?..