SkinnedMesh.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SkinnedMesh - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Mesh.html">Mesh</a> → </p>
  13. <h1 translate="no">SkinnedMesh</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A mesh that has a <a href="Skeleton.html">Skeleton</a> that can then be used to animate the
  17. vertices of the geometry with skinning/skeleton animation.</p>
  18. <p>Next to a valid skeleton, the skinned mesh requires skin indices and weights
  19. as buffer attributes in its geometry. These attribute define which bones affect a single
  20. vertex to a certain extend.</p>
  21. <p>Typically skinned meshes are not created manually but loaders like <a href="GLTFLoader.html">GLTFLoader</a>
  22. or <a href="FBXLoader.html">FBXLoader</a> import respective models.</p></div>
  23. <iframe id="viewer" src="../scenes/bones-browser.html"></iframe>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="SkinnedMesh" translate="no">new <a href="#SkinnedMesh">SkinnedMesh</a><span class="signature">( geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a> | Array.&lt;<a href="Material.html">Material</a>></span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new skinned mesh.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>geometry</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The mesh geometry.</p>
  41. </td>
  42. </tr>
  43. <tr>
  44. <td class="name">
  45. <strong>material</strong>
  46. </td>
  47. <td class="description last">
  48. <p>The mesh material.</p>
  49. </td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Properties</h2>
  56. <div class="member">
  57. <h3 class="name" id="bindMatrix" translate="no">.<a href="#bindMatrix">bindMatrix</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  58. <div class="description">
  59. <p>The base matrix that is used for the bound bone transforms.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="bindMatrixInverse" translate="no">.<a href="#bindMatrixInverse">bindMatrixInverse</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  64. <div class="description">
  65. <p>The base matrix that is used for resetting the bound bone transforms.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="bindMode" translate="no">.<a href="#bindMode">bindMode</a><span class="type-signature"> : <a href="global.html#AttachedBindMode">AttachedBindMode</a> | <a href="global.html#DetachedBindMode">DetachedBindMode</a></span> </h3>
  70. <div class="description">
  71. <p><code>AttachedBindMode</code> means the skinned mesh shares the same world space as the skeleton.
  72. This is not true when using <code>DetachedBindMode</code> which is useful when sharing a skeleton
  73. across multiple skinned meshes.</p>
  74. <p>Default is <code>AttachedBindMode</code>.</p>
  75. </div>
  76. </div>
  77. <div class="member">
  78. <h3 class="name" id="boundingBox" translate="no">.<a href="#boundingBox">boundingBox</a><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
  79. <div class="description">
  80. <p>The bounding box of the skinned mesh. Can be computed via <a href="SkinnedMesh.html#computeBoundingBox">SkinnedMesh#computeBoundingBox</a>.</p>
  81. <p>Default is <code>null</code>.</p>
  82. </div>
  83. </div>
  84. <div class="member">
  85. <h3 class="name" id="boundingSphere" translate="no">.<a href="#boundingSphere">boundingSphere</a><span class="type-signature"> : <a href="Sphere.html">Sphere</a></span> </h3>
  86. <div class="description">
  87. <p>The bounding sphere of the skinned mesh. Can be computed via <a href="SkinnedMesh.html#computeBoundingSphere">SkinnedMesh#computeBoundingSphere</a>.</p>
  88. <p>Default is <code>null</code>.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="isSkinnedMesh" translate="no">.<a href="#isSkinnedMesh">isSkinnedMesh</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  93. <div class="description">
  94. <p>This flag can be used for type testing.</p>
  95. <p>Default is <code>true</code>.</p>
  96. </div>
  97. </div>
  98. <h2 class="subsection-title">Methods</h2>
  99. <h3 class="name name-method" id="applyBoneTransform" translate="no">.<a href="#applyBoneTransform">applyBoneTransform</a><span class="signature">( index : <span class="param-type">number</span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  100. <div class="method">
  101. <div class="description">
  102. <p>Applies the bone transform associated with the given index to the given
  103. vertex position. Returns the updated vector.</p>
  104. </div>
  105. <table class="params">
  106. <tbody>
  107. <tr>
  108. <td class="name">
  109. <strong>index</strong>
  110. </td>
  111. <td class="description last">
  112. <p>The vertex index.</p>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td class="name">
  117. <strong>target</strong>
  118. </td>
  119. <td class="description last">
  120. <p>The target object that is used to store the method's result.
  121. the skinned mesh's world matrix will be used instead.</p>
  122. </td>
  123. </tr>
  124. </tbody>
  125. </table>
  126. <dl class="details">
  127. <dt class="tag-returns"><strong>Returns:</strong> The updated vertex position.</dt>
  128. </dl>
  129. </div>
  130. <h3 class="name name-method" id="bind" translate="no">.<a href="#bind">bind</a><span class="signature">( skeleton : <span class="param-type"><a href="Skeleton.html">Skeleton</a></span>, bindMatrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span> </h3>
  131. <div class="method">
  132. <div class="description">
  133. <p>Binds the given skeleton to the skinned mesh.</p>
  134. </div>
  135. <table class="params">
  136. <tbody>
  137. <tr>
  138. <td class="name">
  139. <strong>skeleton</strong>
  140. </td>
  141. <td class="description last">
  142. <p>The skeleton to bind.</p>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td class="name">
  147. <strong>bindMatrix</strong>
  148. </td>
  149. <td class="description last">
  150. <p>The bind matrix. If no bind matrix is provided,
  151. the skinned mesh's world matrix will be used instead.</p>
  152. </td>
  153. </tr>
  154. </tbody>
  155. </table>
  156. </div>
  157. <h3 class="name name-method" id="computeBoundingBox" translate="no">.<a href="#computeBoundingBox">computeBoundingBox</a><span class="signature">()</span> </h3>
  158. <div class="method">
  159. <div class="description">
  160. <p>Computes the bounding box of the skinned mesh, and updates <a href="SkinnedMesh.html#boundingBox">SkinnedMesh#boundingBox</a>.
  161. The bounding box is not automatically computed by the engine; this method must be called by your app.
  162. If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect
  163. the current animation state.</p>
  164. </div>
  165. </div>
  166. <h3 class="name name-method" id="computeBoundingSphere" translate="no">.<a href="#computeBoundingSphere">computeBoundingSphere</a><span class="signature">()</span> </h3>
  167. <div class="method">
  168. <div class="description">
  169. <p>Computes the bounding sphere of the skinned mesh, and updates <a href="SkinnedMesh.html#boundingSphere">SkinnedMesh#boundingSphere</a>.
  170. The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting
  171. and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed
  172. per frame in order to reflect the current animation state.</p>
  173. </div>
  174. </div>
  175. <h3 class="name name-method" id="normalizeSkinWeights" translate="no">.<a href="#normalizeSkinWeights">normalizeSkinWeights</a><span class="signature">()</span> </h3>
  176. <div class="method">
  177. <div class="description">
  178. <p>Normalizes the skin weights which are defined as a buffer attribute
  179. in the skinned mesh's geometry.</p>
  180. </div>
  181. </div>
  182. <h3 class="name name-method" id="pose" translate="no">.<a href="#pose">pose</a><span class="signature">()</span> </h3>
  183. <div class="method">
  184. <div class="description">
  185. <p>This method sets the skinned mesh in the rest pose).</p>
  186. </div>
  187. </div>
  188. <h2 class="subsection-title">Source</h2>
  189. <p>
  190. <a href="https://github.com/mrdoob/three.js/blob/master/src/objects/SkinnedMesh.js" translate="no" target="_blank" rel="noopener">src/objects/SkinnedMesh.js</a>
  191. </p>
  192. </article>
  193. </section>
  194. <script src="../scripts/linenumber.js"></script>
  195. <script src="../scripts/page.js"></script>
  196. </body>
  197. </html>
粤ICP备19079148号