MD2Character.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MD2Character - 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">MD2Character</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class represents a management component for animated MD2
  16. character assets.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">MD2Character</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 { MD2Character } from 'three/addons/misc/MD2Character.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="MD2Character" translate="no">new <a href="#MD2Character">MD2Character</a><span class="signature">()</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new MD2 character.</p>
  28. </div>
  29. </div>
  30. </div>
  31. <h2 class="subsection-title">Properties</h2>
  32. <div class="member">
  33. <h3 class="name" id="activeAnimationClipName" translate="no">.<a href="#activeAnimationClipName">activeAnimationClipName</a><span class="type-signature"> : string</span> </h3>
  34. <div class="description">
  35. <p>The name of the active animation clip.</p>
  36. <p>Default is <code>null</code>.</p>
  37. </div>
  38. </div>
  39. <div class="member">
  40. <h3 class="name" id="animationFPS" translate="no">.<a href="#animationFPS">animationFPS</a><span class="type-signature"> : number</span> </h3>
  41. <div class="description">
  42. <p>The FPS</p>
  43. <p>Default is <code>6</code>.</p>
  44. </div>
  45. </div>
  46. <div class="member">
  47. <h3 class="name" id="meshBody" translate="no">.<a href="#meshBody">meshBody</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  48. <div class="description">
  49. <p>The body mesh.</p>
  50. <p>Default is <code>null</code>.</p>
  51. </div>
  52. </div>
  53. <div class="member">
  54. <h3 class="name" id="meshWeapon" translate="no">.<a href="#meshWeapon">meshWeapon</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  55. <div class="description">
  56. <p>The weapon mesh.</p>
  57. <p>Default is <code>null</code>.</p>
  58. </div>
  59. </div>
  60. <div class="member">
  61. <h3 class="name" id="mixer" translate="no">.<a href="#mixer">mixer</a><span class="type-signature"> : <a href="AnimationMixer.html">AnimationMixer</a></span> </h3>
  62. <div class="description">
  63. <p>The animation mixer.</p>
  64. <p>Default is <code>null</code>.</p>
  65. </div>
  66. </div>
  67. <div class="member">
  68. <h3 class="name" id="root" translate="no">.<a href="#root">root</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  69. <div class="description">
  70. <p>The root 3D object</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="scale" translate="no">.<a href="#scale">scale</a><span class="type-signature"> : number</span> </h3>
  75. <div class="description">
  76. <p>The mesh scale.</p>
  77. <p>Default is <code>1</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="skinsBody" translate="no">.<a href="#skinsBody">skinsBody</a><span class="type-signature"> : Array.&lt;<a href="Texture.html">Texture</a>></span> </h3>
  82. <div class="description">
  83. <p>The body skins.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="skinsWeapon" translate="no">.<a href="#skinsWeapon">skinsWeapon</a><span class="type-signature"> : Array.&lt;<a href="Texture.html">Texture</a>></span> </h3>
  88. <div class="description">
  89. <p>The weapon skins.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="weapons" translate="no">.<a href="#weapons">weapons</a><span class="type-signature"> : Array.&lt;<a href="Mesh.html">Mesh</a>></span> </h3>
  94. <div class="description">
  95. <p>The weapon meshes.</p>
  96. </div>
  97. </div>
  98. <h2 class="subsection-title">Methods</h2>
  99. <h3 class="name name-method" id="loadParts" translate="no">.<a href="#loadParts">loadParts</a><span class="signature">( config : <span class="param-type">Object</span> )</span> </h3>
  100. <div class="method">
  101. <div class="description">
  102. <p>Loads the character model for the given config.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name">
  108. <strong>config</strong>
  109. </td>
  110. <td class="description last">
  111. <p>The config which defines the model and textures paths.</p>
  112. </td>
  113. </tr>
  114. </tbody>
  115. </table>
  116. </div>
  117. <h3 class="name name-method" id="onLoadComplete" translate="no">.<a href="#onLoadComplete">onLoadComplete</a><span class="signature">()</span> </h3>
  118. <div class="method">
  119. <div class="description">
  120. <p>The <code>onLoad</code> callback function.</p>
  121. </div>
  122. </div>
  123. <h3 class="name name-method" id="setAnimation" translate="no">.<a href="#setAnimation">setAnimation</a><span class="signature">( clipName : <span class="param-type">string</span> )</span> </h3>
  124. <div class="method">
  125. <div class="description">
  126. <p>Sets the defined animation clip as the active animation.</p>
  127. </div>
  128. <table class="params">
  129. <tbody>
  130. <tr>
  131. <td class="name">
  132. <strong>clipName</strong>
  133. </td>
  134. <td class="description last">
  135. <p>The name of the animation clip.</p>
  136. </td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. </div>
  141. <h3 class="name name-method" id="setPlaybackRate" translate="no">.<a href="#setPlaybackRate">setPlaybackRate</a><span class="signature">( rate : <span class="param-type">number</span> )</span> </h3>
  142. <div class="method">
  143. <div class="description">
  144. <p>Sets the animation playback rate.</p>
  145. </div>
  146. <table class="params">
  147. <tbody>
  148. <tr>
  149. <td class="name">
  150. <strong>rate</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The playback rate to set.</p>
  154. </td>
  155. </tr>
  156. </tbody>
  157. </table>
  158. </div>
  159. <h3 class="name name-method" id="setSkin" translate="no">.<a href="#setSkin">setSkin</a><span class="signature">( index : <span class="param-type">number</span> )</span> </h3>
  160. <div class="method">
  161. <div class="description">
  162. <p>Sets the skin defined by the given skin index. This will result in a different texture
  163. for the body mesh.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name">
  169. <strong>index</strong>
  170. </td>
  171. <td class="description last">
  172. <p>The skin index.</p>
  173. </td>
  174. </tr>
  175. </tbody>
  176. </table>
  177. </div>
  178. <h3 class="name name-method" id="setWeapon" translate="no">.<a href="#setWeapon">setWeapon</a><span class="signature">( index : <span class="param-type">number</span> )</span> </h3>
  179. <div class="method">
  180. <div class="description">
  181. <p>Sets the weapon defined by the given weapon index. This will result in a different weapon
  182. hold by the character.</p>
  183. </div>
  184. <table class="params">
  185. <tbody>
  186. <tr>
  187. <td class="name">
  188. <strong>index</strong>
  189. </td>
  190. <td class="description last">
  191. <p>The weapon index.</p>
  192. </td>
  193. </tr>
  194. </tbody>
  195. </table>
  196. </div>
  197. <h3 class="name name-method" id="setWireframe" translate="no">.<a href="#setWireframe">setWireframe</a><span class="signature">( wireframeEnabled : <span class="param-type">boolean</span> )</span> </h3>
  198. <div class="method">
  199. <div class="description">
  200. <p>Sets the wireframe material flag.</p>
  201. </div>
  202. <table class="params">
  203. <tbody>
  204. <tr>
  205. <td class="name">
  206. <strong>wireframeEnabled</strong>
  207. </td>
  208. <td class="description last">
  209. <p>Whether to enable wireframe rendering or not.</p>
  210. </td>
  211. </tr>
  212. </tbody>
  213. </table>
  214. </div>
  215. <h3 class="name name-method" id="syncWeaponAnimation" translate="no">.<a href="#syncWeaponAnimation">syncWeaponAnimation</a><span class="signature">()</span> </h3>
  216. <div class="method">
  217. <div class="description">
  218. <p>Synchronizes the weapon with the body animation.</p>
  219. </div>
  220. </div>
  221. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( delta : <span class="param-type">number</span> )</span> </h3>
  222. <div class="method">
  223. <div class="description">
  224. <p>Updates the animations of the mesh. Must be called inside the animation loop.</p>
  225. </div>
  226. <table class="params">
  227. <tbody>
  228. <tr>
  229. <td class="name">
  230. <strong>delta</strong>
  231. </td>
  232. <td class="description last">
  233. <p>The delta time in seconds.</p>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. </div>
  239. <h2 class="subsection-title">Source</h2>
  240. <p>
  241. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MD2Character.js" translate="no" target="_blank" rel="noopener">examples/jsm/misc/MD2Character.js</a>
  242. </p>
  243. </article>
  244. </section>
  245. <script src="../scripts/linenumber.js"></script>
  246. <script src="../scripts/page.js"></script>
  247. </body>
  248. </html>
粤ICP备19079148号