A Physics handler for MMD resources.
[name] calculates Physics for model loaded by [page:MMDLoader] with ammo.js (Bullet-based JavaScript Physics engine).
var physics;
// Load MMD resources and instantiate MMDPhysics
new THREE.MMDLoader().load(
'models/mmd/miku.pmd',
function ( mesh ) {
physics = new THREE.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 );
}
[example:webgl_loader_mmd]
[page:SkinnedMesh mesh] — [page:SkinnedMesh] for which [name] calculates Physics.
[page:Array rigidBodyParams] — An array of [page:Object] specifying Rigid Body parameters.
[page:Array constraintParams] — (optional) An array of [page:Object] specifying Constraint parameters.
[page:Object params] — (optional)
Creates a new [name].
[page:SkinnedMesh] passed to the constructor.
Return [page:MMDPhysicsHelper]. You can visualize Rigid bodies by adding the helper to scene.
Resets Rigid bodies transorm to current bone's.
[page:Vector3 gravity] — Direction and volume of gravity.
Set gravity.
[page:Number delta] — Time in second.
Advance Physics calculation and updates bones.
[page:Number delta] — Time in second.
Warm up Rigid bodies. Calculates cycles steps.
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/MMDPhysics.js examples/js/animation/MMDPhysics.js]