2
0

Skeleton.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. Use an array of [page:Bone bones] to create a skeleton that can be used by a
  13. [page:SkinnedMesh].
  14. </p>
  15. <h2>Code Example</h2>
  16. <code>
  17. // Create a simple "arm"
  18. const bones = [];
  19. const shoulder = new THREE.Bone();
  20. const elbow = new THREE.Bone();
  21. const hand = new THREE.Bone();
  22. shoulder.add( elbow );
  23. elbow.add( hand );
  24. bones.push( shoulder );
  25. bones.push( elbow );
  26. bones.push( hand );
  27. shoulder.position.y = -5;
  28. elbow.position.y = 0;
  29. hand.position.y = 5;
  30. const armSkeleton = new THREE.Skeleton( bones );
  31. </code>
  32. <p>
  33. See the [page:SkinnedMesh] page for an example of usage with standard [page:BufferGeometry].
  34. </p>
  35. <h2>Constructor</h2>
  36. <h3>[name]( [param:Array bones], [param:Array boneInverses] )</h3>
  37. <p>
  38. [page:Array bones] - The array of [page:Bone bones]. Default is an empty array.<br/>
  39. [page:Array boneInverses] - (optional) An array of [page:Matrix4 Matrix4s].<br /><br />
  40. Creates a new [name].
  41. </p>
  42. <h2>Properties</h2>
  43. <h3>[property:Array bones]</h3>
  44. <p>
  45. The array of [page:bone bones]. Note this is a copy of the original array, not a reference,
  46. so you can modify the original array without effecting this one.
  47. </p>
  48. <h3>[property:Array boneInverses]</h3>
  49. <p>
  50. An array of [page:Matrix4 Matrix4s] that represent the inverse of the [page:Matrix4 matrixWorld]
  51. of the individual bones.
  52. </p>
  53. <h3>[property:Float32Array boneMatrices]</h3>
  54. <p>
  55. The array buffer holding the bone data when using a vertex texture.
  56. </p>
  57. <h3>[property:DataTexture boneTexture]</h3>
  58. <p>
  59. The [page:DataTexture] holding the bone data when using a vertex texture.
  60. </p>
  61. <h3>[property:Integer boneTextureSize]</h3>
  62. <p>
  63. The size of the [page:.boneTexture].
  64. </p>
  65. <h2>Methods</h2>
  66. <h3>[method:Skeleton clone]()</h3>
  67. <p>
  68. Returns a clone of this Skeleton object.
  69. </p>
  70. <h3>[method:null calculateInverses]()</h3>
  71. <p>Generates the [page:.boneInverses boneInverses] array if not provided in the constructor.</p>
  72. <h3>[method:null pose]()</h3>
  73. <p>Returns the skeleton to the base pose.</p>
  74. <h3>[method:null update]()</h3>
  75. <p>
  76. Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture] after changing the bones.
  77. This is called automatically by the [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
  78. </p>
  79. <h3>[method:Bone getBoneByName]( [param:String name] )</h3>
  80. <p>
  81. name -- String to match to the Bone's .name property. <br /><br />
  82. Searches through the skeleton's bone array and returns the first with a matching name.<br />
  83. </p>
  84. <h3>[method:null dispose]()</h3>
  85. <p>
  86. Can be used if an instance of [name] becomes obsolete in an application. The method will free internal resources.
  87. </p>
  88. <h2>Source</h2>
  89. <p>
  90. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  91. </p>
  92. </body>
  93. </html>