Skeleton.html 2.8 KB

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