CCDIKSolver.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc"> A solver for IK with <a href="https://sites.google.com/site/auraliusproject/ccd-algorithm"><em>CCD Algorithm</em></a>. <br /><br />
  12. [name] solves Inverse Kinematics Problem with CCD Algorithm.
  13. [name] is designed to work with [page:SkinnedMesh] loaded by [page:MMDLoader] but also can be used for generic [page:SkinnedMesh].
  14. </p>
  15. <h2>Code Example</h2>
  16. <code>
  17. let ikSolver;
  18. // Load MMD resources and instantiate CCDIKSolver
  19. new MMDLoader().load(
  20. 'models/mmd/miku.pmd',
  21. function ( mesh ) {
  22. ikSolver = new CCDIKSolver( mesh, mesh.geometry.iks );
  23. scene.add( mesh );
  24. }
  25. );
  26. function render() {
  27. animate(); // update bones
  28. if ( ikSolver !== undefined ) ikSolver.update();
  29. renderer.render( scene, camera );
  30. }
  31. </code>
  32. <h2>Examples</h2>
  33. <p>
  34. [example:webgl_loader_mmd]<br />
  35. [example:webgl_loader_mmd_pose]<br />
  36. [example:webgl_loader_mmd_audio]
  37. </p>
  38. <h2>Constructor</h2>
  39. <h3>[name]( [param:SkinnedMesh mesh], [param:Array iks] )</h3>
  40. <p>
  41. [page:SkinnedMesh mesh] — [page:SkinnedMesh] for which [name] solves IK problem.<br />
  42. [page:Array iks] — An array of [page:Object] specifying IK parameter. target, effector, and link-index are index integers in .skeleton.bones.
  43. The bones relation should be "links[ n ], links[ n - 1 ], ..., links[ 0 ], effector" in order from parent to child.<br />
  44. <ul>
  45. <li>[page:Integer target] — Target bone.</li>
  46. <li>[page:Integer effector] — Effector bone.</li>
  47. <li>[page:Array links] — An array of [page: Object] specifying link bones.
  48. <ul>
  49. <li>[page:Integer index] — Link bone.</li>
  50. <li>[page:Vector3 limitation] — (optional) Rotation axis. Default is undefined.</li>
  51. <li>[page:Vector3 rotationMin] — (optional) Rotation minimum limit. Default is undefined.</li>
  52. <li>[page:Vector3 rotationMax] — (optional) Rotation maximum limit. Default is undefined.</li>
  53. <li>[page:Boolean enabled] — (optional) Default is true.</li>
  54. </ul>
  55. </li>
  56. <li>[page:Integer iteration] — (optional) Iteration number of calculation. Smaller is faster but less precise. Default is 1.</li>
  57. <li>[page:Number minAngle] — (optional) Minimum rotation angle in a step. Default is undefined.</li>
  58. <li>[page:Number maxAngle] — (optional) Maximum rotation angle in a step. Default is undefined.</li>
  59. </ul>
  60. </p>
  61. <p>
  62. Creates a new [name].
  63. </p>
  64. <h2>Properties</h2>
  65. <h3>[property:Array iks]</h3>
  66. <p>An array of IK parameter passed to the constructor.</p>
  67. <h3>[property:SkinnedMesh mesh]</h3>
  68. <p>[page:SkinnedMesh] passed to the constructor.</p>
  69. <h2>Methods</h2>
  70. <h3>[method:CCDIKHelper createHelper]()</h3>
  71. <p>
  72. Return [page:CCDIKHelper]. You can visualize IK bones by adding the helper to scene.
  73. </p>
  74. <h3>[method:CCDIKSolver update]()</h3>
  75. <p>
  76. Update IK bones quaternion by solving CCD algorithm.
  77. </p>
  78. <h3>[method:CCDIKSolver updateOne]( [param:Object ikParam] )</h3>
  79. <p>
  80. Update an IK bone quaternion by solving CCD algorithm.
  81. </p>
  82. <h2>Source</h2>
  83. <p>
  84. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js examples/jsm/animation/CCDIKSolver.js]
  85. </p>
  86. </body>
  87. </html>