Capítulo 157 de 859

Chapter 157: BVHLoader

Core Idea

A loader for the BVH format.

Imports BVH files and outputs a single Skeleton and AnimationClip. The loader only supports BVH files containing a single root right now.

Key Concepts

  • animateBonePositions : boolean: Whether to animate bone positions or not.
  • animateBoneRotations : boolean: Whether to animate bone rotations or not.

Code Examples

const loader = new BVHLoader();
const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' );
// visualize skeleton
const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
scene.add( result.skeleton.bones[ 0 ] );
scene.add( skeletonHelper );
// play animation clip
mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] );
mixer.clipAction( result.clip ).play();
  • What it demonstrates: Typical usage of BVHLoader.

Reference Tables

Constructor

Signature
new BVHLoader( manager : LoadingManager )

Properties

PropertyDescription
.animateBonePositions : booleanWhether to animate bone positions or not.
.animateBoneRotations : booleanWhether to animate bone rotations or not.

Methods

MethodDescription
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback )Starts loading from the given URL and passes the loaded BVH asset to the onLoad() callback.
.parse( text : string ) : ObjectParses the given BVH data and returns the resulting data.

Key Takeaways

  1. BVHLoader extends: Loader
  2. Most relevant properties: animateBonePositions, animateBoneRotations.
  3. Key methods: load, parse.

Connects To