CCDIKSolver.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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">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">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">SkinnedMesh</span>, iks : <span class="param-type">Array.&lt;CCDIKSolver~IK></span> )</span> </h3>
  25. <div class="method">
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name"><code>mesh</code></td>
  30. <td class="description last"><p>The skinned mesh.</p></td>
  31. </tr>
  32. <tr>
  33. <td class="name"><code>iks</code></td>
  34. <td class="description last"><p>The IK objects.<br/>Default is <code>[]</code>.</p></td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. </div>
  39. </div>
  40. <h2 class="subsection-title">Properties</h2>
  41. <div class="member">
  42. <h3 class="name" id="iks" translate="no">.<a href="#iks">iks</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
  43. <div class="description">
  44. <p>The IK objects.</p>
  45. </div>
  46. </div>
  47. <div class="member">
  48. <h3 class="name" id="mesh" translate="no">.<a href="#mesh">mesh</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
  49. <div class="description">
  50. <p>The skinned mesh.</p>
  51. </div>
  52. </div>
  53. <h2 class="subsection-title">Methods</h2>
  54. <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>
  55. <div class="method">
  56. <div class="description">
  57. <p>Creates a helper for visualizing the CCDIK.</p>
  58. </div>
  59. <table class="params">
  60. <tbody>
  61. <tr>
  62. <td class="name"><code>sphereSize</code></td>
  63. <td class="description last"><p>The sphere size.</p></td>
  64. </tr>
  65. </tbody>
  66. </table>
  67. <dl class="details">
  68. <dt class="tag-returns"><strong>Returns:</strong> The created helper.</dt>
  69. </dl>
  70. </div>
  71. <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>
  72. <div class="method">
  73. <div class="description">
  74. <p>Updates all IK bones by solving the CCD algorithm.</p>
  75. </div>
  76. <table class="params">
  77. <tbody>
  78. <tr>
  79. <td class="name"><code>globalBlendFactor</code></td>
  80. <td class="description last"><p>Blend factor applied if an IK chain doesn't have its own .blendFactor.<br/>Default is <code>1.0</code>.</p></td>
  81. </tr>
  82. </tbody>
  83. </table>
  84. <dl class="details">
  85. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  86. </dl>
  87. </div>
  88. <h3 class="name name-method" id="updateOne" translate="no">.<a href="#updateOne">updateOne</a><span class="signature">( ik : <span class="param-type">CCDIKSolver~IK</span>, overrideBlend : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKSolver.html">CCDIKSolver</a></span> </h3>
  89. <div class="method">
  90. <div class="description">
  91. <p>Updates one IK bone solving the CCD algorithm.</p>
  92. </div>
  93. <table class="params">
  94. <tbody>
  95. <tr>
  96. <td class="name"><code>ik</code></td>
  97. <td class="description last"><p>The IK to update.</p></td>
  98. </tr>
  99. <tr>
  100. <td class="name"><code>overrideBlend</code></td>
  101. <td class="description last"><p>If the IK object does not define <code>blendFactor</code>, this value is used.<br/>Default is <code>1.0</code>.</p></td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. <dl class="details">
  106. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  107. </dl>
  108. </div>
  109. <h2 class="subsection-title">Type Definitions</h2>
  110. <div class="member">
  111. <h3 class="name" id="~BoneLink" translate="no">.<a href="#~BoneLink">BoneLink</a> </h3>
  112. <div class="description">
  113. <p>This type represents bone links.</p>
  114. </div>
  115. <h5 class="subsection-title">Properties:</h5>
  116. <table class="props">
  117. <thead>
  118. <tr>
  119. <th>Name</th>
  120. <th>Type</th>
  121. <th>Attributes</th>
  122. <th>Default</th>
  123. <th class="last">Description</th>
  124. </tr>
  125. </thead>
  126. <tbody>
  127. <tr>
  128. <td class="name"><code>index</code></td>
  129. <td class="type">
  130. <span class="param-type">number</span>
  131. </td>
  132. <td class="attributes">
  133. </td>
  134. <td class="default">
  135. </td>
  136. <td class="description last"><p>The index of a linked bone which refers to a bone in the <code>Skeleton.bones</code> array.</p></td>
  137. </tr>
  138. <tr>
  139. <td class="name"><code>limitation</code></td>
  140. <td class="type">
  141. <span class="param-type">number</span>
  142. </td>
  143. <td class="attributes">
  144. &lt;optional><br>
  145. </td>
  146. <td class="default">
  147. </td>
  148. <td class="description last"><p>Rotation axis.</p></td>
  149. </tr>
  150. <tr>
  151. <td class="name"><code>rotationMin</code></td>
  152. <td class="type">
  153. <span class="param-type">number</span>
  154. </td>
  155. <td class="attributes">
  156. &lt;optional><br>
  157. </td>
  158. <td class="default">
  159. </td>
  160. <td class="description last"><p>Rotation minimum limit.</p></td>
  161. </tr>
  162. <tr>
  163. <td class="name"><code>rotationMax</code></td>
  164. <td class="type">
  165. <span class="param-type">number</span>
  166. </td>
  167. <td class="attributes">
  168. &lt;optional><br>
  169. </td>
  170. <td class="default">
  171. </td>
  172. <td class="description last"><p>Rotation maximum limit.</p></td>
  173. </tr>
  174. <tr>
  175. <td class="name"><code>enabled</code></td>
  176. <td class="type">
  177. <span class="param-type">boolean</span>
  178. </td>
  179. <td class="attributes">
  180. &lt;optional><br>
  181. </td>
  182. <td class="default">
  183. true
  184. </td>
  185. <td class="description last"><p>Whether the link is enabled or not.</p></td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. </div>
  190. <div class="member">
  191. <h3 class="name" id="~IK" translate="no">.<a href="#~IK">IK</a> </h3>
  192. <div class="description">
  193. <p>This type represents IK configuration objects.</p>
  194. </div>
  195. <h5 class="subsection-title">Properties:</h5>
  196. <table class="props">
  197. <thead>
  198. <tr>
  199. <th>Name</th>
  200. <th>Type</th>
  201. <th>Attributes</th>
  202. <th>Default</th>
  203. <th class="last">Description</th>
  204. </tr>
  205. </thead>
  206. <tbody>
  207. <tr>
  208. <td class="name"><code>target</code></td>
  209. <td class="type">
  210. <span class="param-type">number</span>
  211. </td>
  212. <td class="attributes">
  213. </td>
  214. <td class="default">
  215. </td>
  216. <td class="description last"><p>The target bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p></td>
  217. </tr>
  218. <tr>
  219. <td class="name"><code>effector</code></td>
  220. <td class="type">
  221. <span class="param-type">number</span>
  222. </td>
  223. <td class="attributes">
  224. </td>
  225. <td class="default">
  226. </td>
  227. <td class="description last"><p>The effector bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p></td>
  228. </tr>
  229. <tr>
  230. <td class="name"><code>links</code></td>
  231. <td class="type">
  232. <span class="param-type">Array.&lt;<a href="CCDIKSolver.html#~BoneLink">CCDIKSolver~BoneLink</a>></span>
  233. </td>
  234. <td class="attributes">
  235. </td>
  236. <td class="default">
  237. </td>
  238. <td class="description last"><p>An array of bone links.</p></td>
  239. </tr>
  240. <tr>
  241. <td class="name"><code>iteration</code></td>
  242. <td class="type">
  243. <span class="param-type">number</span>
  244. </td>
  245. <td class="attributes">
  246. &lt;optional><br>
  247. </td>
  248. <td class="default">
  249. 1
  250. </td>
  251. <td class="description last"><p>Iteration number of calculation. Smaller is faster but less precise.</p></td>
  252. </tr>
  253. <tr>
  254. <td class="name"><code>minAngle</code></td>
  255. <td class="type">
  256. <span class="param-type">number</span>
  257. </td>
  258. <td class="attributes">
  259. &lt;optional><br>
  260. </td>
  261. <td class="default">
  262. </td>
  263. <td class="description last"><p>Minimum rotation angle in a step in radians.</p></td>
  264. </tr>
  265. <tr>
  266. <td class="name"><code>maxAngle</code></td>
  267. <td class="type">
  268. <span class="param-type">number</span>
  269. </td>
  270. <td class="attributes">
  271. &lt;optional><br>
  272. </td>
  273. <td class="default">
  274. </td>
  275. <td class="description last"><p>Minimum rotation angle in a step in radians.</p></td>
  276. </tr>
  277. <tr>
  278. <td class="name"><code>blendFactor</code></td>
  279. <td class="type">
  280. <span class="param-type">number</span>
  281. </td>
  282. <td class="attributes">
  283. &lt;optional><br>
  284. </td>
  285. <td class="default">
  286. </td>
  287. <td class="description last"><p>The blend factor.</p></td>
  288. </tr>
  289. </tbody>
  290. </table>
  291. </div>
  292. <h2 class="subsection-title">Source</h2>
  293. <p>
  294. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js" target="_blank" rel="noopener" translate="no">examples/jsm/animation/CCDIKSolver.js</a>
  295. </p>
  296. </article>
  297. </section>
  298. <script src="../scripts/linenumber.js"></script>
  299. <script src="../scripts/page.js"></script>
  300. </body>
  301. </html>
粤ICP备19079148号