CCDIKSolver.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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>Example</h2>
  17. <code>
  18. var ikSolver;
  19. // Load MMD resources and instantiate CCDIKSolver
  20. new THREE.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. [example:webgl_loader_mmd]<br />
  34. [example:webgl_loader_mmd_pose]<br />
  35. [example:webgl_loader_mmd_audio]<br />
  36. <br />
  37. <hr>
  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 bones quaternion by solving CCD algorithm.
  77. </p>
  78. <h2>Source</h2>
  79. <p>
  80. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/CCDIKSolver.js examples/js/animation/CCDIKSolver.js]
  81. </p>
  82. </body>
  83. </html>