What is boneContainer doing?

Hi,
For loading BVH animations I often see the following boilerplate:

loader.load( "models/bvh/pirouette.bvh", function( result ) {

				skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
				skeletonHelper.skeleton = result.skeleton; // allow animation mixer to bind to SkeletonHelper directly

				var boneContainer = new THREE.Group();
				boneContainer.add( result.skeleton.bones[ 0 ] );

				scene.add( skeletonHelper );
				scene.add( boneContainer );

				// play animation
				mixer = new THREE.AnimationMixer( skeletonHelper );
				mixer.clipAction( result.clip ).setEffectiveWeight( 1.0 ).play();

			} );

What are the following two lines doing? Anything at all? :smiley:

var boneContainer = new THREE.Group();
boneContainer.add( result.skeleton.bones[ 0 ] );

The initial result.skeleton.bones[ 0 ] may often have key frames assigned to it, meaning any transformation of the root bone object would be reset on animation updates, this prevents a lot of freedom when wanting to create transformations of the model such as moving forwards and or rotating based on an input, creating and assigning the rig to the group object you’re referring to would typically allow programmatically animating transforms of the entire rig without interference of key frames assigned to the root bone

2 Likes

Oh, so it’s like a way to move entire skeleton without overwriting the position of the root, yes?
One may call it a “Root’s parent”, right?

The funny thing is that I see this “boneContainer” logic in projects which don’t even allow for movemement of the entire skeleton :smiley: But they probably don’t delete it, because they think it is necessary