| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>MD2Character - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">MD2Character</h1>
- <section>
- <header>
- <div class="class-description"><p>This class represents a management component for animated MD2
- character assets.</p></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <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>
- <pre><code class="language-js">import { MD2Character } from 'three/addons/misc/MD2Character.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="MD2Character" translate="no">new <a href="#MD2Character">MD2Character</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new MD2 character.</p>
- </div>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="activeAnimationClipName" translate="no">.<a href="#activeAnimationClipName">activeAnimationClipName</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The name of the active animation clip.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="animationFPS" translate="no">.<a href="#animationFPS">animationFPS</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The FPS</p>
- <p>Default is <code>6</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="meshBody" translate="no">.<a href="#meshBody">meshBody</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
- <div class="description">
- <p>The body mesh.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="meshWeapon" translate="no">.<a href="#meshWeapon">meshWeapon</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
- <div class="description">
- <p>The weapon mesh.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="mixer" translate="no">.<a href="#mixer">mixer</a><span class="type-signature"> : <a href="AnimationMixer.html">AnimationMixer</a></span> </h3>
- <div class="description">
- <p>The animation mixer.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="root" translate="no">.<a href="#root">root</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
- <div class="description">
- <p>The root 3D object</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="scale" translate="no">.<a href="#scale">scale</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The mesh scale.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="skinsBody" translate="no">.<a href="#skinsBody">skinsBody</a><span class="type-signature"> : Array.<<a href="Texture.html">Texture</a>></span> </h3>
- <div class="description">
- <p>The body skins.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="skinsWeapon" translate="no">.<a href="#skinsWeapon">skinsWeapon</a><span class="type-signature"> : Array.<<a href="Texture.html">Texture</a>></span> </h3>
- <div class="description">
- <p>The weapon skins.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="weapons" translate="no">.<a href="#weapons">weapons</a><span class="type-signature"> : Array.<<a href="Mesh.html">Mesh</a>></span> </h3>
- <div class="description">
- <p>The weapon meshes.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <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>
- <div class="method">
- <div class="description">
- <p>Loads the character model for the given config.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>config</strong>
- </td>
- <td class="description last">
- <p>The config which defines the model and textures paths.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="onLoadComplete" translate="no">.<a href="#onLoadComplete">onLoadComplete</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>The <code>onLoad</code> callback function.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the defined animation clip as the active animation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>clipName</strong>
- </td>
- <td class="description last">
- <p>The name of the animation clip.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the animation playback rate.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>rate</strong>
- </td>
- <td class="description last">
- <p>The playback rate to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the skin defined by the given skin index. This will result in a different texture
- for the body mesh.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The skin index.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the weapon defined by the given weapon index. This will result in a different weapon
- hold by the character.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The weapon index.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the wireframe material flag.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>wireframeEnabled</strong>
- </td>
- <td class="description last">
- <p>Whether to enable wireframe rendering or not.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="syncWeaponAnimation" translate="no">.<a href="#syncWeaponAnimation">syncWeaponAnimation</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Synchronizes the weapon with the body animation.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Updates the animations of the mesh. Must be called inside the animation loop.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>delta</strong>
- </td>
- <td class="description last">
- <p>The delta time in seconds.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <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>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|