Object3D.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  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. <div class="desc">Base class for scene graph objects.</div>
  12. <h2>Constructor</h2>
  13. <h3>[name]()</h3>
  14. <h2>Properties</h2>
  15. <h3>.[page:Integer id]</h3>
  16. <div>
  17. Unique number of this object instance.
  18. </div>
  19. <h3>.[page:String name]</h3>
  20. <div>
  21. Optional name of the object (doesn't need to be unique).
  22. </div>
  23. <h3>.[page:Object3D parent]</h3>
  24. <div>
  25. Object's parent in the scene graph.
  26. </div>
  27. <h3>.[page:Object3D children]</h3>
  28. <div>
  29. Array with object's children.
  30. </div>
  31. <h3>.[page:Vector3 position]</h3>
  32. <div>
  33. Object's local position.
  34. </div>
  35. <h3>.[page:Vector3 rotation]</h3>
  36. <div>
  37. Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles">Euler angles</a>), in radians.
  38. </div>
  39. <h3>.[page:String eulerOrder]</h3>
  40. <div>
  41. Order of axis for Euler angles.
  42. </div>
  43. <h3>.[page:Vector3 scale]</h3>
  44. <div>
  45. Object's local scale.
  46. </div>
  47. <h3>.[page:Vector3 up]</h3>
  48. <div>
  49. Up direction.
  50. </div>
  51. <h3>.[page:Matrix4 matrix]</h3>
  52. <div>
  53. Local transform.
  54. </div>
  55. <h3>.[page:Quaternion quaternion]</h3>
  56. <div>
  57. Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
  58. </div>
  59. <h3>.[page:Boolean useQuaternion]</h3>
  60. <div>
  61. Use quaternion instead of Euler angles for specifying local rotation.
  62. </div>
  63. <h3>.[page:Float renderDepth]</h3>
  64. <div>
  65. Override depth-sorting order if non *null*.
  66. </div>
  67. <h3>.[page:Boolean visible]</h3>
  68. <div>
  69. Object gets rendered if *true*.
  70. </div>
  71. <h3>.[page:Boolean castShadow]</h3>
  72. <div>
  73. Gets rendered into shadow map.
  74. </div>
  75. <h3>.[page:Boolean receiveShadow]</h3>
  76. <div>
  77. Material gets baked in shadow receiving.
  78. </div>
  79. <h3>.[page:Boolean frustumCulled]</h3>
  80. <div>
  81. When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible.
  82. </div>
  83. <h3>.[page:Boolean matrixAutoUpdate]</h3>
  84. <div>
  85. When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.
  86. </div>
  87. <h3>.[page:Boolean matrixWorldNeedsUpdate]</h3>
  88. <div>
  89. When this is set, it calculates the matrixWorld in that frame and resets this property to false.
  90. </div>
  91. <h3>.[page:Boolean rotationAutoUpdate]</h3>
  92. <div>
  93. When this is set, then the rotationMatrix gets calculated every frame.
  94. </div>
  95. <h2>Methods</h2>
  96. <h3>.applyMatrix( [page:Matrix4 matrix])</h3>
  97. <div>
  98. matrix - matrix
  99. </div>
  100. <div>
  101. This updates the position, rotation and scale with the matrix.
  102. </div>
  103. <h3>.translate( [page:Float distance], [page:Vector3 axis] )</h3>
  104. <div>
  105. distance - Distance.<br />
  106. axis - Translation direction.
  107. </div>
  108. <div>
  109. Translates object along arbitrary *axis* by *distance*.
  110. </div>
  111. <h3>.translateX( [page:Float distance] )</h3>
  112. <div>
  113. distance - Distance.<br />
  114. </div>
  115. <div>
  116. Translates object along x axis by distance.
  117. </div>
  118. <h3>.translateY( [page:Float distance] )</h3>
  119. <div>
  120. distance - Distance.<br />
  121. </div>
  122. <div>
  123. Translates object along y axis by distance.
  124. </div>
  125. <h3>.translateZ( [page:Float distance] )</h3>
  126. <div>
  127. distance - Distance.<br />
  128. </div>
  129. <div>
  130. Translates object along z axis by distance.
  131. </div>
  132. <h3>.localToWorld( [page:Vector3 vector] )</h3>
  133. <div>
  134. vector - A local vector.<br />
  135. </div>
  136. <div>
  137. Updates the vector from local space to world space.
  138. </div>
  139. <h3>.worldToLocal( [page:Vector3 vector] )</h3>
  140. <div>
  141. vector - A world vector.<br />
  142. </div>
  143. <div>
  144. Updates the vector from world space to local space.
  145. </div>
  146. <h3>.lookAt( [page:Vector3 vector] )</h3>
  147. <div>
  148. vector - A world vector to look at.<br />
  149. </div>
  150. <div>
  151. Rotates object to face point in space.
  152. </div>
  153. <h3>.add( [page:Object3D object] )</h3>
  154. <div>
  155. object - An object.<br />
  156. </div>
  157. <div>
  158. Adds *object* as child of this object.
  159. </div>
  160. <h3>.remove( [page:Object3D object] )</h3>
  161. <div>
  162. object - An object.<br />
  163. </div>
  164. <div>
  165. Removes *object* as child of this object.
  166. </div>
  167. <h3>.traverse( [page:Function callback] )</h3>
  168. <div>
  169. callback - An Function with as first argument an object3D object.<br />
  170. </div>
  171. <div>
  172. Executes the callback on this object and all descendants.
  173. </div>
  174. <h3>.getChildByName( [page:String name], [page:Boolean recursive] )</h3>
  175. <div>
  176. name - Object name.<br />
  177. recursive - Whether check in the objects's children.
  178. </div>
  179. <div>
  180. Gets first child with name matching the argument. Searches whole subgraph recursively if *recursive* is true.
  181. </div>
  182. <h3>.getDescendants( [page:Array array] )</h3>
  183. <div>
  184. array - optional argument that returns the the array with descendants.<br />
  185. </div>
  186. <div>
  187. Searches whole subgraph recursively to add all objects in the array.
  188. </div>
  189. <h3>.updateMatrix()</h3>
  190. <div>
  191. Updates local transform.
  192. </div>
  193. <h3>.updateMatrixWorld( [page:Boolean force] )</h3>
  194. <div>
  195. Updates global transform of the object and its children.
  196. </div>
  197. <h3>.clone()</h3>
  198. <div>
  199. Creates a new clone of this object and all descendants.
  200. </div>
  201. <h2>Source</h2>
  202. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  203. </body>
  204. </html>