MMDPhysics.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <p class="desc"> A Physics handler for <a href="http://www.geocities.jp/higuchuu4/index_e.htm"><em>MMD</em></a> resources. <br /><br />
  13. [name] calculates Physics for model loaded by [page:MMDLoader] with <a href="https://github.com/kripken/ammo.js/">ammo.js</a> (Bullet-based JavaScript Physics engine).
  14. </p>
  15. <h2>Example</h2>
  16. <code>
  17. var physics;
  18. // Load MMD resources and instantiate MMDPhysics
  19. new THREE.MMDLoader().load(
  20. 'models/mmd/miku.pmd',
  21. function ( mesh ) {
  22. physics = new THREE.MMDPhysics( mesh )
  23. scene.add( mesh );
  24. }
  25. );
  26. function render() {
  27. var delta = clock.getDelta();
  28. animate( delta ); // update bones
  29. if ( physics !== undefined ) physics.update( delta );
  30. renderer.render( scene, camera );
  31. }
  32. </code>
  33. [example:webgl_loader_mmd]<br />
  34. [example:webgl_loader_mmd_audio]<br />
  35. <br />
  36. <hr>
  37. <h2>Constructor</h2>
  38. <h3>[name]( [param:SkinnedMesh mesh], [param:Array rigidBodyParams], [param:Array constraintParams], [param:Object params] )</h3>
  39. <p>
  40. [page:SkinnedMesh mesh] — [page:SkinnedMesh] for which [name] calculates Physics.<br />
  41. [page:Array rigidBodyParams] — An array of [page:Object] specifying Rigid Body parameters.<br />
  42. [page:Array constraintParams] — (optional) An array of [page:Object] specifying Constraint parameters.<br />
  43. [page:Object params] — (optional)<br />
  44. <ul>
  45. <li>[page:Number unitStep] - Default is 1 / 65.</li>
  46. <li>[page:Integer maxStepNum] - Default is 3.</li>
  47. <li>[page:Vector3 gravity] - Default is ( 0, - 9.8 * 10, 0 )</li>
  48. </ul>
  49. </p>
  50. <p>
  51. Creates a new [name].
  52. </p>
  53. <h2>Properties</h2>
  54. <h3>[property:Array mesh]</h3>
  55. <p>[page:SkinnedMesh] passed to the constructor.</p>
  56. <h2>Methods</h2>
  57. <h3>[method:MMDPhysicsHelper createHelper]()</h3>
  58. <p>
  59. Return [page:MMDPhysicsHelper]. You can visualize Rigid bodies by adding the helper to scene.
  60. </p>
  61. <h3>[method:CCDIKSolver reset]()</h3>
  62. <p>
  63. Resets Rigid bodies transorm to current bone's.
  64. </p>
  65. <h3>[method:CCDIKSolver setGravity]( [param:Vector3 gravity] )</h3>
  66. <p>
  67. [page:Vector3 gravity] — Direction and volume of gravity.
  68. </p>
  69. <p>
  70. Set gravity.
  71. </p>
  72. <h3>[method:CCDIKSolver update]( [param:Number delta] )</h3>
  73. <p>
  74. [page:Number delta] — Time in second.
  75. </p>
  76. <p>
  77. Advance Physics calculation and updates bones.
  78. </p>
  79. <h3>[method:CCDIKSolver warmup]( [param:Integer cycles] )</h3>
  80. <p>
  81. [page:Number delta] — Time in second.
  82. </p>
  83. <p>
  84. Warm up Rigid bodies. Calculates cycles steps.
  85. </p>
  86. <h2>Source</h2>
  87. <p>
  88. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/MMDPhysics.js examples/js/animation/MMDPhysics.js]
  89. </p>
  90. </body>
  91. </html>