CCDIKSolver.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CCDIKSolver - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">CCDIKSolver</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class solves the Inverse Kinematics Problem with a <a href="https://web.archive.org/web/20221206080850/https://sites.google.com/site/auraliusproject/ccd-algorithm" target="_blank" rel="noopener">CCD Algorithm</a>.</p>
  16. <p><code>CCDIKSolver</code> is designed to work with instances of <a href="SkinnedMesh.html">SkinnedMesh</a>.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">CCDIKSolver</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  21. <pre><code class="language-js">import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="CCDIKSolver" translate="no">new <a href="#CCDIKSolver">CCDIKSolver</a><span class="signature">( mesh : <span class="param-type"><a href="SkinnedMesh.html">SkinnedMesh</a></span>, iks : <span class="param-type">Array.&lt;<a href="CCDIKSolver.html#~IK">CCDIKSolver~IK</a>></span> )</span> </h3>
  25. <div class="method">
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>mesh</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The skinned mesh.</p>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td class="name">
  38. <strong>iks</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The IK objects.</p>
  42. <p>Default is <code>[]</code>.</p>
  43. </td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Properties</h2>
  50. <div class="member">
  51. <h3 class="name" id="iks" translate="no">.<a href="#iks">iks</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
  52. <div class="description">
  53. <p>The IK objects.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="mesh" translate="no">.<a href="#mesh">mesh</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
  58. <div class="description">
  59. <p>The skinned mesh.</p>
  60. </div>
  61. </div>
  62. <h2 class="subsection-title">Methods</h2>
  63. <h3 class="name name-method" id="createHelper" translate="no">.<a href="#createHelper">createHelper</a><span class="signature">( sphereSize : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKHelper.html">CCDIKHelper</a></span> </h3>
  64. <div class="method">
  65. <div class="description">
  66. <p>Creates a helper for visualizing the CCDIK.</p>
  67. </div>
  68. <table class="params">
  69. <tbody>
  70. <tr>
  71. <td class="name">
  72. <strong>sphereSize</strong>
  73. </td>
  74. <td class="description last">
  75. <p>The sphere size.</p>
  76. </td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <dl class="details">
  81. <dt class="tag-returns"><strong>Returns:</strong> The created helper.</dt>
  82. </dl>
  83. </div>
  84. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( globalBlendFactor : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKSolver.html">CCDIKSolver</a></span> </h3>
  85. <div class="method">
  86. <div class="description">
  87. <p>Updates all IK bones by solving the CCD algorithm.</p>
  88. </div>
  89. <table class="params">
  90. <tbody>
  91. <tr>
  92. <td class="name">
  93. <strong>globalBlendFactor</strong>
  94. </td>
  95. <td class="description last">
  96. <p>Blend factor applied if an IK chain doesn't have its own .blendFactor.</p>
  97. <p>Default is <code>1.0</code>.</p>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  104. </dl>
  105. </div>
  106. <h3 class="name name-method" id="updateOne" translate="no">.<a href="#updateOne">updateOne</a><span class="signature">( ik : <span class="param-type"><a href="CCDIKSolver.html#~IK">CCDIKSolver~IK</a></span>, overrideBlend : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKSolver.html">CCDIKSolver</a></span> </h3>
  107. <div class="method">
  108. <div class="description">
  109. <p>Updates one IK bone solving the CCD algorithm.</p>
  110. </div>
  111. <table class="params">
  112. <tbody>
  113. <tr>
  114. <td class="name">
  115. <strong>ik</strong>
  116. </td>
  117. <td class="description last">
  118. <p>The IK to update.</p>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td class="name">
  123. <strong>overrideBlend</strong>
  124. </td>
  125. <td class="description last">
  126. <p>If the IK object does not define <code>blendFactor</code>, this value is used.</p>
  127. <p>Default is <code>1.0</code>.</p>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  134. </dl>
  135. </div>
  136. <h2 class="subsection-title">Type Definitions</h2>
  137. <div class="member">
  138. <h3 class="name" id="~BoneLink" translate="no">.<a href="#~BoneLink">BoneLink</a> </h3>
  139. <div class="description">
  140. <p>This type represents bone links.</p>
  141. </div>
  142. <table class="props">
  143. <tbody>
  144. <tr>
  145. <td class="name">
  146. <strong>index</strong>
  147. <br>
  148. <span class="param-type">number</span>
  149. </td>
  150. <td class="description last">
  151. <p>The index of a linked bone which refers to a bone in the <code>Skeleton.bones</code> array.</p>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td class="name">
  156. <strong>limitation</strong>
  157. <br>
  158. <span class="param-type">number</span>
  159. </td>
  160. <td class="description last">
  161. <p>Rotation axis.</p>
  162. </td>
  163. </tr>
  164. <tr>
  165. <td class="name">
  166. <strong>rotationMin</strong>
  167. <br>
  168. <span class="param-type">number</span>
  169. </td>
  170. <td class="description last">
  171. <p>Rotation minimum limit.</p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td class="name">
  176. <strong>rotationMax</strong>
  177. <br>
  178. <span class="param-type">number</span>
  179. </td>
  180. <td class="description last">
  181. <p>Rotation maximum limit.</p>
  182. </td>
  183. </tr>
  184. <tr>
  185. <td class="name">
  186. <strong>enabled</strong>
  187. <br>
  188. <span class="param-type">boolean</span>
  189. </td>
  190. <td class="description last">
  191. <p>Whether the link is enabled or not.</p>
  192. <p>Default is <code>true</code>.</p>
  193. </td>
  194. </tr>
  195. </tbody>
  196. </table>
  197. </div>
  198. <div class="member">
  199. <h3 class="name" id="~IK" translate="no">.<a href="#~IK">IK</a> </h3>
  200. <div class="description">
  201. <p>This type represents IK configuration objects.</p>
  202. </div>
  203. <table class="props">
  204. <tbody>
  205. <tr>
  206. <td class="name">
  207. <strong>target</strong>
  208. <br>
  209. <span class="param-type">number</span>
  210. </td>
  211. <td class="description last">
  212. <p>The target bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td class="name">
  217. <strong>effector</strong>
  218. <br>
  219. <span class="param-type">number</span>
  220. </td>
  221. <td class="description last">
  222. <p>The effector bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p>
  223. </td>
  224. </tr>
  225. <tr>
  226. <td class="name">
  227. <strong>links</strong>
  228. <br>
  229. <span class="param-type">Array.&lt;<a href="CCDIKSolver.html#~BoneLink">CCDIKSolver~BoneLink</a>></span>
  230. </td>
  231. <td class="description last">
  232. <p>An array of bone links.</p>
  233. </td>
  234. </tr>
  235. <tr>
  236. <td class="name">
  237. <strong>iteration</strong>
  238. <br>
  239. <span class="param-type">number</span>
  240. </td>
  241. <td class="description last">
  242. <p>Iteration number of calculation. Smaller is faster but less precise.</p>
  243. <p>Default is <code>1</code>.</p>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td class="name">
  248. <strong>minAngle</strong>
  249. <br>
  250. <span class="param-type">number</span>
  251. </td>
  252. <td class="description last">
  253. <p>Minimum rotation angle in a step in radians.</p>
  254. </td>
  255. </tr>
  256. <tr>
  257. <td class="name">
  258. <strong>maxAngle</strong>
  259. <br>
  260. <span class="param-type">number</span>
  261. </td>
  262. <td class="description last">
  263. <p>Minimum rotation angle in a step in radians.</p>
  264. </td>
  265. </tr>
  266. <tr>
  267. <td class="name">
  268. <strong>blendFactor</strong>
  269. <br>
  270. <span class="param-type">number</span>
  271. </td>
  272. <td class="description last">
  273. <p>The blend factor.</p>
  274. </td>
  275. </tr>
  276. </tbody>
  277. </table>
  278. </div>
  279. <h2 class="subsection-title">Source</h2>
  280. <p>
  281. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js" translate="no" target="_blank" rel="noopener">examples/jsm/animation/CCDIKSolver.js</a>
  282. </p>
  283. </article>
  284. </section>
  285. <script src="../scripts/linenumber.js"></script>
  286. <script src="../scripts/page.js"></script>
  287. </body>
  288. </html>
粤ICP备19079148号