MMDPhysics

A Physics handler for MMD resources.

MMDPhysics calculates Physics for model loaded by MMDLoader with ammo.js (Bullet-based JavaScript Physics engine).

Example

var physics; // Load MMD resources and instantiate MMDPhysics new v3d.MMDLoader().load( 'models/mmd/miku.pmd', function(mesh) { physics = new v3d.MMDPhysics(mesh) scene.add(mesh); } ); function render() { var delta = clock.getDelta(); animate(delta); // update bones if (physics !== undefined) physics.update(delta); renderer.render(scene, camera); } webgl_loader_mmd
webgl_loader_mmd_audio


Constructor

MMDPhysics(mesh : SkinnedMesh, rigidBodyParams : Array, constraintParams : Array, params : Object)

meshSkinnedMesh for which MMDPhysics calculates Physics.
rigidBodyParams — An array of Object specifying Rigid Body parameters.
constraintParams — (optional) An array of Object specifying Constraint parameters.
params — (optional)

Creates a new MMDPhysics.

Properties

.mesh : Array

SkinnedMesh passed to the constructor.

Methods

.createHelper () : MMDPhysicsHelper

Return MMDPhysicsHelper. You can visualize Rigid bodies by adding the helper to scene.

.reset () : CCDIKSolver

Resets Rigid bodies transorm to current bone's.

.setGravity (gravity : Vector3) : CCDIKSolver

gravity — Direction and volume of gravity.

Set gravity.

.update (delta : Number) : CCDIKSolver

delta — Time in second.

Advance Physics calculation and updates bones.

.warmup (cycles : Integer) : CCDIKSolver

delta — Time in second.

Warm up Rigid bodies. Calculates cycles steps.

Source

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