1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>
<p class="desc"> A animation helper for <a href="http://www.geocities.jp/higuchuu4/index_e.htm"><em>MMD</em></a> resources. <br /><br />
[name] handles animation of MMD assets loaded by [page:MMDLoader] with MMD special features as IK, Grant, and Physics.
It uses [page:CCDIKSolver] and [page:MMDPhysics] inside.
</p>
<h2>Example</h2>
<code>
// Instantiate a helper
var helper = new THREE.MMDAnimationHelper();
// Load MMD resources and add to helper
new THREE.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 THREE.AudioLoader().load(
'audios/mmd/song.mp3',
function ( buffer ) {
var listener = new THREE.AudioListener();
var audio = new THREE.Audio( listener )
.setBuffer( buffer );
listener.position.z = 1;
scene.add( audio );
scene.add( listener );
}
);
}
);
function render() {
helper.update( clock.getDelta() );
renderer.render( scene, camera );
}
</code>
[example:webgl_loader_mmd]<br />
[example:webgl_loader_mmd_pose]<br />
[example:webgl_loader_mmd_audio]<br />
<br />
<hr>
<h2>Constructor</h2>
<h3>[name]( [param:Object params] )</h3>
<p>
[page:Object params] — (optional)<br />
<ul>
<li> [page:Boolean sync] - Whether animation durations of added objects are synched. Default is true.</li>
<li> [page:Number afterglow] - Default is 0.0.</li>
<li> [page:Boolean resetPhysicsOnLoop] - Default is true.</li>
</ul>
</p>
<p>
Creates a new [name].
</p>
<h2>Properties</h2>
<h3>[property:Audio audio]</h3>
<p>An [page:Audio] added to helper.</p>
<h3>[property:Camera camera]</h3>
<p>An [page:Camera] added to helper.</p>
<h3>[property:Array meshes]</h3>
<p>An array of [page:SkinnedMesh] added to helper.</p>
<h3>[property:WeakMap objects]</h3>
<p>A [page:WeakMap] which holds animation stuffs used in helper for objects added to helper. For example, you can access [page:AnimationMixer] for an added [page:SkinnedMesh] with "helper.objects.get( mesh ).mixer"</p>
<h3>[property:function onBeforePhysics]</h3>
<p>An optional callback that is executed immediately before the physicis calculation for an [page:SkinnedMesh]. This function is called with the [page:SkinnedMesh].</p>
<h2>Methods</h2>
<h3>[method:MMDAnimationHelper add]( [param:Object3D object], [param:Object params] )</h3>
<p>
[page:Object3D object] — [page:SkinnedMesh], [page:Camera], or [page:Audio]<br />
[page:Object params] — (optional)<br />
<ul>
<li>[page:AnimationClip animation] - an [page:AnimationClip] or an array of [page:AnimationClip] set to object. Only for [page:SkinnedMesh] and [page:Camera]. Default is undefined.</li>
<li>[page:Boolean physics] - Only for [page:SkinnedMesh]. A flag whether turn on physics. Default is true.</li>
<li>[page:Integer warmup] - Only for [page:SkinnedMesh] and physics is true. Physics parameter. Default is 60.</li>
<li>[page:Number unitStep] - Only for [page:SkinnedMesh] and physics is true. Physics parameter. Default is 1 / 65.</li>
<li>[page:Integer maxStepNum] - Only for [page:SkinnedMesh] and physics is true. Physics parameter. Default is 3.</li>
<li>[page:Vector3 gravity] - Only for [page:SkinnedMesh] and physics is true. Physics parameter. Default is ( 0, - 9.8 * 10, 0 ).</li>
<li>[page:Number delayTime] - Only for [page:Audio]. Default is 0.0.</li>
</ul>
</p>
<p>
Add an [page:SkinnedMesh], [page:Camera], or [page: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.
</p>
<h3>[method:MMDAnimationHelper enable]( [param:string key], [param:Boolean enabled] )</h3>
<p>
[page:string key] — Allowed strings are 'animation', 'ik', 'grant', 'physics', and 'cameraAnimation'.<br />
[page:Boolean enabled] — true is enable, false is disable<br />
</p>
<p>
Enable/Disable an animation feature
</p>
<h3>[method:MMDAnimationHelper pose]( [param:SkinnedMesh mesh], [param:Object vpd], [param:Object params] )</h3>
<p>
[page:SkinnedMesh mesh] — [page:SkinnedMesh] which changes the posing. It doesn't need to be added to helper.<br />
[page:Object vpd] — VPD content obtained by [page:MMDLoader].loadVPD<br />
[page:Object params] — (optional)<br />
<ul>
<li>[page:Boolean resetPose] - Default is true.</li>
<li>[page:Boolean ik] - Default is true.</li>
<li>[page:Boolean grant] - Default is true.</li>
</ul>
</p>
<p>
Changes the posing of [page:SkinnedMesh] as VPD content specifies.
</p>
<h3>[method:MMDAnimationHelper remove]( [param:Object3D object] )</h3>
<p>
[page:Object3D object] — [page:SkinnedMesh], [page:Camera], or [page:Audio]<br />
</p>
<p>
Remove an [page:SkinnedMesh], [page:Camera], or [page:Audio] from helper.
</p>
<h3>[method:MMDAnimationHelper update]( [param:Nummber delta] )</h3>
<p>
[page:Number delta] — number in second<br />
</p>
<p>
Advance mixer time and update the animations of objects added to helper
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/MMDAnimationHelper.js examples/js/animation/MMDAnimationHelper.js]
</p>
</body>
</html>
|