There are a few questions here about using Three.js to animate a mesh character (or characters) with .bvh files. I’m no expert, but this was really exciting to me and I wished to post at least one way to do it here for discussion.
Basically, a few things have to be set up:
a. You need to have models with a bone hierarchy that matches (mostly) the hierarchy of the .bvh files that you want to use.
BVHLoader returns a
Skeleton and an
AnimationClip. You’ll want to use the
AnimationClip but not the supplied
b. Even with matching names in your files, you may need to change the track names in the provided
AnimationClip. The names provided work fine for simpler models but don’t seem to find the bones in a model that’s nested in objects and groups.
Fiddle is here: https://jsfiddle.net/mrfewq7s/57/. The “model” is not very complex and is just made of primatives but the same method works for OBJ and GLTF humanoid models and more complicated .bvh files. Simpler might be better for demonstration anyway, but (importantly) I can’t seem to get Blender to export a suitable rigged mesh…
Let me know what you think!