Problem with BVHLoader keyframes, position keyframes are relative instead of absolute

I’m not sure this is an actual issue of BVHLoader or not so I’m posting here.

Problem description

Could you explain why these lines add bone offset to each keyframe positions?

Once we confirm that this is an uncommon way to load, I can make a PR to fix this.

I have an environment to try the behavior quickly.
Just drag and drop the BVH file into the canvas.

https://0b5vr.com/three-playground/#bvh

Code origin

It seems this is an ancient code from 2016, when the BVHLoader is introduced for the first time.

Other tools

It seems that Blender does not do the behavior at least. It simply substitutes the position in the motion frame to the local position of each bones.

I don’t have any access to other DCC tools which supports BVH though.

Context

I was trying to parse BVH motions output from mocopi and found the problem, the motion is 2x larger than the actual human scale.
And it occurs only when I play AnimationActions, it is on the scale properly when I’m not playing the animation.

You can download an example motion Sample.BVH, it’s included in its BVH Sender archive (JP).

I believe the same problem occurs when we load Bandai-Namco-Research-Motiondataset, since it also has motion frames with positions.

The pirouette.bvh doesn’t have the problem since this one does not have positions in motion frames.