Object3D.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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. <div>
  15. The constructor takes no arguments.
  16. </div>
  17. <h2>Properties</h2>
  18. <h3>[property:Integer id]</h3>
  19. <div>
  20. Unique number for this object instance.
  21. </div>
  22. <h3>[property:String uuid]</h3>
  23. <div>
  24. [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
  25. This gets automatically assigned, so this shouldn't be edited.
  26. </div>
  27. <h3>[property:String name]</h3>
  28. <div>
  29. Optional name of the object (doesn't need to be unique).
  30. </div>
  31. <h3>[property:Object3D parent]</h3>
  32. <div>
  33. Object's parent in the scene graph.
  34. </div>
  35. <h3>[property:Object3D children]</h3>
  36. <div>
  37. Array with object's children.
  38. </div>
  39. <h3>[property:Vector3 position]</h3>
  40. <div>
  41. Object's local position.
  42. </div>
  43. <h3>[property:Euler rotation]</h3>
  44. <div>
  45. Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles" target="_blank">Euler angles</a>), in radians.
  46. </div>
  47. <h3>[property:String eulerOrder]</h3>
  48. <div>
  49. Order of axis for Euler angles.
  50. </div>
  51. <h3>[property:Vector3 scale]</h3>
  52. <div>
  53. Object's local scale.
  54. </div>
  55. <h3>[property:Vector3 up]</h3>
  56. <div>
  57. Up direction.
  58. </div>
  59. <h3>[property:Matrix4 matrix]</h3>
  60. <div>
  61. Local transform.
  62. </div>
  63. <h3>[property:Quaternion quaternion]</h3>
  64. <div>
  65. Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
  66. </div>
  67. <h3>[property:Boolean useQuaternion]</h3>
  68. <div>
  69. Use quaternion instead of Euler angles for specifying local rotation.
  70. </div>
  71. <h3>[property:Float renderDepth]</h3>
  72. <div>
  73. Override depth-sorting order if non *null*.
  74. </div>
  75. <h3>[property:Boolean visible]</h3>
  76. <div>
  77. Object gets rendered if *true*.
  78. </div>
  79. <h3>[property:Boolean castShadow]</h3>
  80. <div>
  81. Gets rendered into shadow map.
  82. </div>
  83. <h3>[property:Boolean receiveShadow]</h3>
  84. <div>
  85. Material gets baked in shadow receiving.
  86. </div>
  87. <h3>[property:Boolean frustumCulled]</h3>
  88. <div>
  89. 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.
  90. </div>
  91. <h3>[property:Boolean matrixAutoUpdate]</h3>
  92. <div>
  93. When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.
  94. </div>
  95. <h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
  96. <div>
  97. When this is set, it calculates the matrixWorld in that frame and resets this property to false.
  98. </div>
  99. <h3>[property:Boolean rotationAutoUpdate]</h3>
  100. <div>
  101. When this is set, then the rotationMatrix gets calculated every frame.
  102. </div>
  103. <h3>[property:object userData]</h3>
  104. <div>
  105. An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.
  106. </div>
  107. <h3>[property:Matrix4 matrixWorld]</h3>
  108. <div>
  109. The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.
  110. </div>
  111. <h2>Methods</h2>
  112. <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
  113. <h3>[method:null applyMatrix]( [page:Matrix4 matrix])</h3>
  114. <div>
  115. matrix - matrix
  116. </div>
  117. <div>
  118. This updates the position, rotation and scale with the matrix.
  119. </div>
  120. <h3>[method:null translateX]( [page:Float distance] )</h3>
  121. <div>
  122. distance - Distance.<br />
  123. </div>
  124. <div>
  125. Translates object along x axis by distance.
  126. </div>
  127. <h3>[method:null translateY]( [page:Float distance] )</h3>
  128. <div>
  129. distance - Distance.<br />
  130. </div>
  131. <div>
  132. Translates object along y axis by distance.
  133. </div>
  134. <h3>[method:null translateZ]( [page:Float distance] )</h3>
  135. <div>
  136. distance - Distance.<br />
  137. </div>
  138. <div>
  139. Translates object along z axis by distance.
  140. </div>
  141. <h3>[method:Vector3 localToWorld]( [page:Vector3 vector] )</h3>
  142. <div>
  143. vector - A local vector.<br />
  144. </div>
  145. <div>
  146. Updates the vector from local space to world space.
  147. </div>
  148. <h3>[method:Vector3 worldToLocal]( [page:Vector3 vector] )</h3>
  149. <div>
  150. vector - A world vector.<br />
  151. </div>
  152. <div>
  153. Updates the vector from world space to local space.
  154. </div>
  155. <h3>[method:null lookAt]( [page:Vector3 vector] )</h3>
  156. <div>
  157. vector - A world vector to look at.<br />
  158. </div>
  159. <div>
  160. Rotates object to face point in space.
  161. </div>
  162. <h3>[method:null add]( [page:Object3D object] )</h3>
  163. <div>
  164. object - An object.<br />
  165. </div>
  166. <div>
  167. Adds *object* as child of this object.
  168. </div>
  169. <h3>[method:null remove]( [page:Object3D object] )</h3>
  170. <div>
  171. object - An object.<br />
  172. </div>
  173. <div>
  174. Removes *object* as child of this object.
  175. </div>
  176. <h3>[method:null traverse]( [page:Function callback] )</h3>
  177. <div>
  178. callback - An Function with as first argument an object3D object.<br />
  179. </div>
  180. <div>
  181. Executes the callback on this object and all descendants.
  182. </div>
  183. <h3>[method:null updateMatrix]()</h3>
  184. <div>
  185. Updates local transform.
  186. </div>
  187. <h3>[method:null updateMatrixWorld]( [page:Boolean force] )</h3>
  188. <div>
  189. Updates global transform of the object and its children.
  190. </div>
  191. <h3>[method:Object3D clone]()</h3>
  192. <div>
  193. Creates a new clone of this object and all descendants.
  194. </div>
  195. <h3>[method:Object3D getObjectByName]([page:String name], [page:Boolean recursive])</h3>
  196. <div>
  197. name -- String to match to the children's Object3d.name property. <br />
  198. recursive -- Boolean whether to search through the children's children. Default is false.
  199. </div>
  200. <div>
  201. Searches through the object's children and returns the first with a matching name, optionally recursive.
  202. </div>
  203. <h3>[method:Object3D getObjectById]([page:Integer id], [page:Boolean recursive])</h3>
  204. <div>
  205. id -- Unique number of the object instance<br />
  206. recursive -- Boolean whether to search through the children's children. Default is false.
  207. </div>
  208. <div>
  209. Searches through the object's children and returns the first with a matching id, optionally recursive.
  210. </div>
  211. <h3>[method:Object3D translateOnAxis]([page:Vector3 axis], [page:Float distance])</h3>
  212. <div>
  213. axis -- A normalized vector in object space.<br />
  214. distance -- The distance to translate.
  215. </div>
  216. <div>
  217. Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
  218. </div>
  219. <h3>[method:Object3D rotateOnAxis]([page:Vector3 axis], [page:Float angle])</h3>
  220. <div>
  221. axis -- A normalized vector in object space. <br />
  222. angle -- The angle in radians.
  223. </div>
  224. <div>
  225. Rotate an object along an axis in object space. The axis is assumed to be normalized.
  226. </div>
  227. <h2>Source</h2>
  228. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  229. </body>
  230. </html>