MD2Character.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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">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.<br/>Default is <code>null</code>.</p>
  36. </div>
  37. </div>
  38. <div class="member">
  39. <h3 class="name" id="animationFPS" translate="no">.<a href="#animationFPS">animationFPS</a><span class="type-signature"> : number</span> </h3>
  40. <div class="description">
  41. <p>The FPS<br/>Default is <code>6</code>.</p>
  42. </div>
  43. </div>
  44. <div class="member">
  45. <h3 class="name" id="meshBody" translate="no">.<a href="#meshBody">meshBody</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  46. <div class="description">
  47. <p>The body mesh.<br/>Default is <code>null</code>.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="meshWeapon" translate="no">.<a href="#meshWeapon">meshWeapon</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  52. <div class="description">
  53. <p>The weapon mesh.<br/>Default is <code>null</code>.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="mixer" translate="no">.<a href="#mixer">mixer</a><span class="type-signature"> : <a href="AnimationMixer.html">AnimationMixer</a></span> </h3>
  58. <div class="description">
  59. <p>The animation mixer.<br/>Default is <code>null</code>.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="root" translate="no">.<a href="#root">root</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  64. <div class="description">
  65. <p>The root 3D object</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="scale" translate="no">.<a href="#scale">scale</a><span class="type-signature"> : number</span> </h3>
  70. <div class="description">
  71. <p>The mesh scale.<br/>Default is <code>1</code>.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <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>
  76. <div class="description">
  77. <p>The body skins.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <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>
  82. <div class="description">
  83. <p>The weapon skins.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <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>
  88. <div class="description">
  89. <p>The weapon meshes.</p>
  90. </div>
  91. </div>
  92. <h2 class="subsection-title">Methods</h2>
  93. <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>
  94. <div class="method">
  95. <div class="description">
  96. <p>Loads the character model for the given config.</p>
  97. </div>
  98. <table class="params">
  99. <tbody>
  100. <tr>
  101. <td class="name"><code>config</code></td>
  102. <td class="description last"><p>The config which defines the model and textures paths.</p></td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. </div>
  107. <h3 class="name name-method" id="onLoadComplete" translate="no">.<a href="#onLoadComplete">onLoadComplete</a><span class="signature">()</span> </h3>
  108. <div class="method">
  109. <div class="description">
  110. <p>The <code>onLoad</code> callback function.</p>
  111. </div>
  112. </div>
  113. <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>
  114. <div class="method">
  115. <div class="description">
  116. <p>Sets the defined animation clip as the active animation.</p>
  117. </div>
  118. <table class="params">
  119. <tbody>
  120. <tr>
  121. <td class="name"><code>clipName</code></td>
  122. <td class="description last"><p>The name of the animation clip.</p></td>
  123. </tr>
  124. </tbody>
  125. </table>
  126. </div>
  127. <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>
  128. <div class="method">
  129. <div class="description">
  130. <p>Sets the animation playback rate.</p>
  131. </div>
  132. <table class="params">
  133. <tbody>
  134. <tr>
  135. <td class="name"><code>rate</code></td>
  136. <td class="description last"><p>The playback rate to set.</p></td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. </div>
  141. <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>
  142. <div class="method">
  143. <div class="description">
  144. <p>Sets the skin defined by the given skin index. This will result in a different texture
  145. for the body mesh.</p>
  146. </div>
  147. <table class="params">
  148. <tbody>
  149. <tr>
  150. <td class="name"><code>index</code></td>
  151. <td class="description last"><p>The skin index.</p></td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. </div>
  156. <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>
  157. <div class="method">
  158. <div class="description">
  159. <p>Sets the weapon defined by the given weapon index. This will result in a different weapon
  160. hold by the character.</p>
  161. </div>
  162. <table class="params">
  163. <tbody>
  164. <tr>
  165. <td class="name"><code>index</code></td>
  166. <td class="description last"><p>The weapon index.</p></td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. <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>
  172. <div class="method">
  173. <div class="description">
  174. <p>Sets the wireframe material flag.</p>
  175. </div>
  176. <table class="params">
  177. <tbody>
  178. <tr>
  179. <td class="name"><code>wireframeEnabled</code></td>
  180. <td class="description last"><p>Whether to enable wireframe rendering or not.</p></td>
  181. </tr>
  182. </tbody>
  183. </table>
  184. </div>
  185. <h3 class="name name-method" id="syncWeaponAnimation" translate="no">.<a href="#syncWeaponAnimation">syncWeaponAnimation</a><span class="signature">()</span> </h3>
  186. <div class="method">
  187. <div class="description">
  188. <p>Synchronizes the weapon with the body animation.</p>
  189. </div>
  190. </div>
  191. <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>
  192. <div class="method">
  193. <div class="description">
  194. <p>Updates the animations of the mesh. Must be called inside the animation loop.</p>
  195. </div>
  196. <table class="params">
  197. <tbody>
  198. <tr>
  199. <td class="name"><code>delta</code></td>
  200. <td class="description last"><p>The delta time in seconds.</p></td>
  201. </tr>
  202. </tbody>
  203. </table>
  204. </div>
  205. <h2 class="subsection-title">Source</h2>
  206. <p>
  207. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MD2Character.js" target="_blank" rel="noopener" translate="no">examples/jsm/misc/MD2Character.js</a>
  208. </p>
  209. </article>
  210. </section>
  211. <script src="../scripts/linenumber.js"></script>
  212. <script src="../scripts/page.js"></script>
  213. </body>
  214. </html>
粤ICP备19079148号