Biovision BVH (motion capture) File Loader

Hello everyone, I am trying to create a BVH loader to load motion capture animations and apply to different skeletons in babylon.js. I believe it would be an amazing addition to the library. I am using a MIT library as a starting point: GitHub - herzig/BVHImporter: JavaScript parser for BVH files and converter to Three.js Bones.

I am working on a project that is really hard to decouple the code so I tried to create a playground to share the code.

Currently, I am facing the following problems:

1 - Playground breaks with error: t.initFunction is not a function
2 - Leaf bones (end sites) are created with the name (End Site) I think the offset I am using is not right.
3 - Animation is breaking because leaf bones have no keyframes.

I know I am close to have something working but I am having a hard time figuring it out. Can anyone help me?

Link to the playground: Babylon.js Playground

Skeleton rendered by Blender
Screenshot from 2024-01-22 18-32-59

Skeleton rendered by Babylon.js
Screenshot from 2024-01-22 18-32-45

The namespace keyword doesn’t work in the Playground, so I’ve updated your code so that it can at least run :

Let’s see if someone can help you debugging the code!

1 Like

Thank you so much @Evgeni_Popov, I can see the bones in the playground now! One problem less!

I changed the code a bit to fill all the bones with keyframes even the leaf nodes, now I am getting another error.

Current Issues:

1 - Leaf bones (end sites) are created with the name (End Site) I think I should use child’s offset.
2 - Animation is breaking with: TypeError: e.copyToArray is not a function.

The new playground: https://www.babylonjs-playground.com/#2FRH5H#3