# [name]

A Physics handler for MMD resources.
[name] calculates Physics for model loaded by [page:MMDLoader] with ammo.js (Bullet-based JavaScript Physics engine).

## Example

`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]
[example:webgl_loader_mmd_audio]

## Constructor

### [name]( [param:SkinnedMesh mesh], [param:Array rigidBodyParams], [param:Array constraintParams], [param:Object params] )

[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)

- [page:Number unitStep] - Default is 1 / 65.
- [page:Integer maxStepNum] - Default is 3.
- [page:Vector3 gravity] - Default is ( 0, - 9.8 * 10, 0 )

Creates a new [name].

## Properties

### [property:Array mesh]

[page:SkinnedMesh] passed to the constructor.

## Methods

### [method:MMDPhysicsHelper createHelper]()

Return [page:MMDPhysicsHelper]. You can visualize Rigid bodies by adding the helper to scene.

### [method:CCDIKSolver reset]()

Resets Rigid bodies transorm to current bone's.

### [method:CCDIKSolver setGravity]( [param:Vector3 gravity] )

[page:Vector3 gravity] — Direction and volume of gravity.

Set gravity.

### [method:CCDIKSolver update]( [param:Number delta] )

[page:Number delta] — Time in second.

Advance Physics calculation and updates bones.

### [method:CCDIKSolver warmup]( [param:Integer cycles] )

[page:Number delta] — Time in second.

Warm up Rigid bodies. Calculates cycles steps.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/MMDPhysics.js examples/js/animation/MMDPhysics.js]