module-SkeletonUtils.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SkeletonUtils - 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">SkeletonUtils</h1>
  13. <section>
  14. <header>
  15. </header>
  16. <article>
  17. <h2 class="subsection-title">Import</h2>
  18. <p><span translate="no">SkeletonUtils</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  19. <pre><code class="language-js">import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js';</code></pre>
  20. <div class="container-overview">
  21. </div>
  22. <h2 class="subsection-title">Methods</h2>
  23. <h3 class="name name-method" id="~clone" translate="no">.<a href="#~clone">clone</a><span class="signature">( source : <span class="param-type">Object3D</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> <span class="type-signature">(inner) </span></h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Clones the given 3D object and its descendants, ensuring that any <code>SkinnedMesh</code> instances are
  27. correctly associated with their bones. Bones are also cloned, and must be descendants of the
  28. object passed to this method. Other data, like geometries and materials, are reused by reference.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name"><code>source</code></td>
  34. <td class="description last"><p>The 3D object to clone.</p></td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. <dl class="details">
  39. <dt class="tag-returns"><strong>Returns:</strong> The cloned 3D object.</dt>
  40. </dl>
  41. </div>
  42. <h3 class="name name-method" id="~retarget" translate="no">.<a href="#~retarget">retarget</a><span class="signature">( target : <span class="param-type">Object3D</span>, source : <span class="param-type">Object3D</span>, options : <span class="param-type">module:SkeletonUtils~RetargetOptions</span> )</span> <span class="type-signature">(inner) </span></h3>
  43. <div class="method">
  44. <div class="description">
  45. <p>Retargets the skeleton from the given source 3D object to the
  46. target 3D object.</p>
  47. </div>
  48. <table class="params">
  49. <tbody>
  50. <tr>
  51. <td class="name"><code>target</code></td>
  52. <td class="description last"><p>The target 3D object.</p></td>
  53. </tr>
  54. <tr>
  55. <td class="name"><code>source</code></td>
  56. <td class="description last"><p>The source 3D object.</p></td>
  57. </tr>
  58. <tr>
  59. <td class="name"><code>options</code></td>
  60. <td class="description last"><p>The options.</p></td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. <h3 class="name name-method" id="~retargetClip" translate="no">.<a href="#~retargetClip">retargetClip</a><span class="signature">( target : <span class="param-type">Object3D</span>, source : <span class="param-type">Object3D</span>, clip : <span class="param-type">AnimationClip</span>, options : <span class="param-type">module:SkeletonUtils~RetargetOptions</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> <span class="type-signature">(inner) </span></h3>
  66. <div class="method">
  67. <div class="description">
  68. <p>Retargets the animation clip of the source object to the
  69. target 3D object.</p>
  70. </div>
  71. <table class="params">
  72. <tbody>
  73. <tr>
  74. <td class="name"><code>target</code></td>
  75. <td class="description last"><p>The target 3D object.</p></td>
  76. </tr>
  77. <tr>
  78. <td class="name"><code>source</code></td>
  79. <td class="description last"><p>The source 3D object.</p></td>
  80. </tr>
  81. <tr>
  82. <td class="name"><code>clip</code></td>
  83. <td class="description last"><p>The animation clip.</p></td>
  84. </tr>
  85. <tr>
  86. <td class="name"><code>options</code></td>
  87. <td class="description last"><p>The options.</p></td>
  88. </tr>
  89. </tbody>
  90. </table>
  91. <dl class="details">
  92. <dt class="tag-returns"><strong>Returns:</strong> The retargeted animation clip.</dt>
  93. </dl>
  94. </div>
  95. <h2 class="subsection-title">Type Definitions</h2>
  96. <div class="member">
  97. <h3 class="name" id="~RetargetOptions" translate="no">.<a href="#~RetargetOptions">RetargetOptions</a> </h3>
  98. <div class="description">
  99. <p>Retarget options of <code>SkeletonUtils</code>.</p>
  100. </div>
  101. <h5 class="subsection-title">Properties:</h5>
  102. <table class="props">
  103. <thead>
  104. <tr>
  105. <th>Name</th>
  106. <th>Type</th>
  107. <th>Attributes</th>
  108. <th>Default</th>
  109. <th class="last">Description</th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. <tr>
  114. <td class="name"><code>useFirstFramePosition</code></td>
  115. <td class="type">
  116. <span class="param-type">boolean</span>
  117. </td>
  118. <td class="attributes">
  119. &lt;optional><br>
  120. </td>
  121. <td class="default">
  122. false
  123. </td>
  124. <td class="description last"><p>Whether to use the position of the first frame or not.</p></td>
  125. </tr>
  126. <tr>
  127. <td class="name"><code>fps</code></td>
  128. <td class="type">
  129. <span class="param-type">number</span>
  130. </td>
  131. <td class="attributes">
  132. &lt;optional><br>
  133. </td>
  134. <td class="default">
  135. </td>
  136. <td class="description last"><p>The FPS of the clip.</p></td>
  137. </tr>
  138. <tr>
  139. <td class="name"><code>names</code></td>
  140. <td class="type">
  141. <span class="param-type">Object.&lt;string, string></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>A dictionary for mapping target to source bone names.</p></td>
  149. </tr>
  150. <tr>
  151. <td class="name"><code>getBoneName</code></td>
  152. <td class="type">
  153. <span class="param-type">function</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>A function for mapping bone names. Alternative to <code>names</code>.</p></td>
  161. </tr>
  162. <tr>
  163. <td class="name"><code>trim</code></td>
  164. <td class="type">
  165. <span class="param-type">Array.&lt;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>Whether to trim the clip or not. If set the array should hold two values for the start and end.</p></td>
  173. </tr>
  174. <tr>
  175. <td class="name"><code>preserveBoneMatrix</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 to preserve bone matrices or not.</p></td>
  186. </tr>
  187. <tr>
  188. <td class="name"><code>preserveBonePositions</code></td>
  189. <td class="type">
  190. <span class="param-type">boolean</span>
  191. </td>
  192. <td class="attributes">
  193. &lt;optional><br>
  194. </td>
  195. <td class="default">
  196. true
  197. </td>
  198. <td class="description last"><p>Whether to preserve bone positions or not.</p></td>
  199. </tr>
  200. <tr>
  201. <td class="name"><code>useTargetMatrix</code></td>
  202. <td class="type">
  203. <span class="param-type">boolean</span>
  204. </td>
  205. <td class="attributes">
  206. &lt;optional><br>
  207. </td>
  208. <td class="default">
  209. false
  210. </td>
  211. <td class="description last"><p>Whether to use the target matrix or not.</p></td>
  212. </tr>
  213. <tr>
  214. <td class="name"><code>hip</code></td>
  215. <td class="type">
  216. <span class="param-type">string</span>
  217. </td>
  218. <td class="attributes">
  219. &lt;optional><br>
  220. </td>
  221. <td class="default">
  222. 'hip'
  223. </td>
  224. <td class="description last"><p>The name of the source's hip bone.</p></td>
  225. </tr>
  226. <tr>
  227. <td class="name"><code>hipInfluence</code></td>
  228. <td class="type">
  229. <span class="param-type"><a href="Vector3.html">Vector3</a></span>
  230. </td>
  231. <td class="attributes">
  232. &lt;optional><br>
  233. </td>
  234. <td class="default">
  235. (1,1,1)
  236. </td>
  237. <td class="description last"><p>The hip influence.</p></td>
  238. </tr>
  239. <tr>
  240. <td class="name"><code>scale</code></td>
  241. <td class="type">
  242. <span class="param-type">number</span>
  243. </td>
  244. <td class="attributes">
  245. &lt;optional><br>
  246. </td>
  247. <td class="default">
  248. 1
  249. </td>
  250. <td class="description last"><p>The scale.</p></td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. </div>
  255. <h2 class="subsection-title">Source</h2>
  256. <p>
  257. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SkeletonUtils.js" target="_blank" rel="noopener" translate="no">examples/jsm/utils/SkeletonUtils.js</a>
  258. </p>
  259. </article>
  260. </section>
  261. <script src="../scripts/linenumber.js"></script>
  262. <script src="../scripts/page.js"></script>
  263. </body>
  264. </html>
粤ICP备19079148号