A Physics handler for MMD resources.
[name] calculates Physics for model loaded by [page:MMDLoader] with ammo.js (Bullet-based JavaScript Physics engine).
const physics;
// Load MMD resources and instantiate MMDPhysics
new MMDLoader().load(
'models/mmd/miku.pmd',
function ( mesh ) {
physics = new MMDPhysics( mesh )
scene.add( mesh );
}
);
function render() {
const delta = clock.getDelta();
animate( delta ); // update bones
if ( physics !== undefined ) physics.update( delta );
renderer.render( scene, camera );
}
[example:webgl_loader_mmd]
[example:webgl_loader_mmd_audio]
[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 transform 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/jsm/animation/MMDPhysics.js examples/jsm/animation/MMDPhysics.js]