MMDPhysics.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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="https://sites.google.com/view/evpvp/"><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>Code Example</h2>
  16. <code>
  17. var physics;
  18. // Load MMD resources and instantiate MMDPhysics
  19. new MMDLoader().load(
  20. 'models/mmd/miku.pmd',
  21. function ( mesh ) {
  22. physics = new 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. <h2>Examples</h2>
  34. <p>
  35. [example:webgl_loader_mmd]<br />
  36. [example:webgl_loader_mmd_audio]
  37. </p>
  38. <h2>Constructor</h2>
  39. <h3>[name]( [param:SkinnedMesh mesh], [param:Array rigidBodyParams], [param:Array constraintParams], [param:Object params] )</h3>
  40. <p>
  41. [page:SkinnedMesh mesh] — [page:SkinnedMesh] for which [name] calculates Physics.<br />
  42. [page:Array rigidBodyParams] — An array of [page:Object] specifying Rigid Body parameters.<br />
  43. [page:Array constraintParams] — (optional) An array of [page:Object] specifying Constraint parameters.<br />
  44. [page:Object params] — (optional)<br />
  45. <ul>
  46. <li>[page:Number unitStep] - Default is 1 / 65.</li>
  47. <li>[page:Integer maxStepNum] - Default is 3.</li>
  48. <li>[page:Vector3 gravity] - Default is ( 0, - 9.8 * 10, 0 )</li>
  49. </ul>
  50. </p>
  51. <p>
  52. Creates a new [name].
  53. </p>
  54. <h2>Properties</h2>
  55. <h3>[property:Array mesh]</h3>
  56. <p>[page:SkinnedMesh] passed to the constructor.</p>
  57. <h2>Methods</h2>
  58. <h3>[method:MMDPhysicsHelper createHelper]()</h3>
  59. <p>
  60. Return [page:MMDPhysicsHelper]. You can visualize Rigid bodies by adding the helper to scene.
  61. </p>
  62. <h3>[method:CCDIKSolver reset]()</h3>
  63. <p>
  64. Resets Rigid bodies transorm to current bone's.
  65. </p>
  66. <h3>[method:CCDIKSolver setGravity]( [param:Vector3 gravity] )</h3>
  67. <p>
  68. [page:Vector3 gravity] — Direction and volume of gravity.
  69. </p>
  70. <p>
  71. Set gravity.
  72. </p>
  73. <h3>[method:CCDIKSolver update]( [param:Number delta] )</h3>
  74. <p>
  75. [page:Number delta] — Time in second.
  76. </p>
  77. <p>
  78. Advance Physics calculation and updates bones.
  79. </p>
  80. <h3>[method:CCDIKSolver warmup]( [param:Integer cycles] )</h3>
  81. <p>
  82. [page:Number delta] — Time in second.
  83. </p>
  84. <p>
  85. Warm up Rigid bodies. Calculates cycles steps.
  86. </p>
  87. <h2>Source</h2>
  88. <p>
  89. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/MMDPhysics.js examples/jsm/animation/MMDPhysics.js]
  90. </p>
  91. </body>
  92. </html>