A animation helper for MMD resources.

MMDAnimationHelper handles animation of MMD assets loaded by MMDLoader with MMD special features as IK, Grant, and Physics. It uses CCDIKSolver and MMDPhysics inside.


// Instantiate a helper var helper = new v3d.MMDAnimationHelper(); // Load MMD resources and add to helper new v3d.MMDLoader().loadWithAnimation( 'models/mmd/miku.pmd', 'models/mmd/dance.vmd', function(mmd) { helper.add(mmd.mesh, { animation: mmd.animation, physics: true }); scene.add(mmd.mesh); new v3d.AudioLoader().load( 'audios/mmd/song.mp3', function(buffer) { var listener = new v3d.AudioListener(); var audio = new v3d.Audio(listener) .setBuffer(buffer); listener.position.z = 1; scene.add(audio); scene.add(listener); } ); } ); function render() { helper.update(clock.getDelta()); renderer.render(scene, camera); } webgl_loader_mmd


MMDAnimationHelper(params : Object)

params — (optional)

Creates a new MMDAnimationHelper.


.audio : Audio

An Audio added to helper.

.camera : Camera

An Camera added to helper.

.meshes : Array

An array of SkinnedMesh added to helper.

.objects : WeakMap

A WeakMap which holds animation stuffs used in helper for objects added to helper. For example, you can access AnimationMixer for an added SkinnedMesh with "helper.objects.get(mesh).mixer"

.onBeforePhysics : function

An optional callback that is executed immediately before the physicis calculation for an SkinnedMesh. This function is called with the SkinnedMesh.


.add (object : Object3D, params : Object) : MMDAnimationHelper

objectSkinnedMesh, Camera, or Audio
params — (optional)

Add an SkinnedMesh, Camera, or Audio to helper and setup animation. The anmation durations of added objects are synched. If camera/audio has already been added, it'll be replaced with a new one.

.enable (key : string, enabled : Boolean) : MMDAnimationHelper

key — Allowed strings are 'animation', 'ik', 'grant', 'physics', and 'cameraAnimation'.
enabled — true is enable, false is disable

Enable/Disable an animation feature

.pose (mesh : SkinnedMesh, vpd : Object, params : Object) : MMDAnimationHelper

meshSkinnedMesh which changes the posing. It doesn't need to be added to helper.
vpd — VPD content obtained by MMDLoader.loadVPD
params — (optional)

Changes the posing of SkinnedMesh as VPD content specifies.

.remove (object : Object3D) : MMDAnimationHelper

objectSkinnedMesh, Camera, or Audio

Remove an SkinnedMesh, Camera, or Audio from helper.

.update (delta : Nummber) : MMDAnimationHelper

delta — number in second

Advance mixer time and update the animations of objects added to helper


For more info on how to obtain the source code of this module see this page.