CCDIKSolver.html 3.3 KB

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