Object3D.html 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Object3D - 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> → </p>
  13. <h1 translate="no">Object3D</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This is the base class for most objects in three.js and provides a set of
  17. properties and methods for manipulating objects in 3D space.</p></div>
  18. </header>
  19. <article>
  20. <div class="container-overview">
  21. <h2>Constructor</h2>
  22. <h3 class="name name-method" id="Object3D" translate="no">new <a href="#Object3D">Object3D</a><span class="signature">()</span> </h3>
  23. <div class="method">
  24. <div class="description">
  25. <p>Constructs a new 3D object.</p>
  26. </div>
  27. </div>
  28. </div>
  29. <h2 class="subsection-title">Properties</h2>
  30. <div class="member">
  31. <h3 class="name" id="animations" translate="no">.<a href="#animations">animations</a><span class="type-signature"> : Array.&lt;<a href="AnimationClip.html">AnimationClip</a>></span> </h3>
  32. <div class="description">
  33. <p>An array holding the animation clips of the 3D object.</p>
  34. </div>
  35. </div>
  36. <div class="member">
  37. <h3 class="name" id="castShadow" translate="no">.<a href="#castShadow">castShadow</a><span class="type-signature"> : boolean</span> </h3>
  38. <div class="description">
  39. <p>When set to <code>true</code>, the 3D object gets rendered into shadow maps.</p>
  40. <p>Default is <code>false</code>.</p>
  41. </div>
  42. </div>
  43. <div class="member">
  44. <h3 class="name" id="children" translate="no">.<a href="#children">children</a><span class="type-signature"> : Array.&lt;<a href="Object3D.html">Object3D</a>></span> </h3>
  45. <div class="description">
  46. <p>An array holding the child 3D objects of this instance.</p>
  47. </div>
  48. </div>
  49. <div class="member">
  50. <h3 class="name" id="customDepthMaterial" translate="no">.<a href="#customDepthMaterial">customDepthMaterial</a><span class="type-signature"> : <a href="Material.html">Material</a> | undefined</span> </h3>
  51. <div class="description">
  52. <p>Custom depth material to be used when rendering to the depth map. Can only be used
  53. in context of meshes. When shadow-casting with a <a href="DirectionalLight.html">DirectionalLight</a> or <a href="SpotLight.html">SpotLight</a>,
  54. if you are modifying vertex positions in the vertex shader you must specify a custom depth
  55. material for proper shadows.</p>
  56. <p>Only relevant in context of <a href="WebGLRenderer.html">WebGLRenderer</a>.</p>
  57. <p>Default is <code>undefined</code>.</p>
  58. </div>
  59. </div>
  60. <div class="member">
  61. <h3 class="name" id="customDistanceMaterial" translate="no">.<a href="#customDistanceMaterial">customDistanceMaterial</a><span class="type-signature"> : <a href="Material.html">Material</a> | undefined</span> </h3>
  62. <div class="description">
  63. <p>Same as <a href="Object3D.html#customDepthMaterial">Object3D#customDepthMaterial</a>, but used with <a href="PointLight.html">PointLight</a>.</p>
  64. <p>Only relevant in context of <a href="WebGLRenderer.html">WebGLRenderer</a>.</p>
  65. <p>Default is <code>undefined</code>.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="frustumCulled" translate="no">.<a href="#frustumCulled">frustumCulled</a><span class="type-signature"> : boolean</span> </h3>
  70. <div class="description">
  71. <p>When set to <code>true</code>, the 3D object is honored by view frustum culling.</p>
  72. <p>Default is <code>true</code>.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="id" translate="no">.<a href="#id">id</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  77. <div class="description">
  78. <p>The ID of the 3D object.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="isObject3D" translate="no">.<a href="#isObject3D">isObject3D</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  83. <div class="description">
  84. <p>This flag can be used for type testing.</p>
  85. <p>Default is <code>true</code>.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="layers" translate="no">.<a href="#layers">layers</a><span class="type-signature"> : <a href="Layers.html">Layers</a></span> </h3>
  90. <div class="description">
  91. <p>The layer membership of the 3D object. The 3D object is only visible if it has
  92. at least one layer in common with the camera in use. This property can also be
  93. used to filter out unwanted objects in ray-intersection tests when using <a href="Raycaster.html">Raycaster</a>.</p>
  94. </div>
  95. </div>
  96. <div class="member">
  97. <h3 class="name" id="matrix" translate="no">.<a href="#matrix">matrix</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  98. <div class="description">
  99. <p>Represents the object's transformation matrix in local space.</p>
  100. </div>
  101. </div>
  102. <div class="member">
  103. <h3 class="name" id="matrixAutoUpdate" translate="no">.<a href="#matrixAutoUpdate">matrixAutoUpdate</a><span class="type-signature"> : boolean</span> </h3>
  104. <div class="description">
  105. <p>When set to <code>true</code>, the engine automatically computes the local matrix from position,
  106. rotation and scale every frame.</p>
  107. <p>The default values for all 3D objects is defined by <code>Object3D.DEFAULT_MATRIX_AUTO_UPDATE</code>.</p>
  108. <p>Default is <code>true</code>.</p>
  109. </div>
  110. </div>
  111. <div class="member">
  112. <h3 class="name" id="matrixWorld" translate="no">.<a href="#matrixWorld">matrixWorld</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  113. <div class="description">
  114. <p>Represents the object's transformation matrix in world space.
  115. If the 3D object has no parent, then it's identical to the local transformation matrix</p>
  116. </div>
  117. </div>
  118. <div class="member">
  119. <h3 class="name" id="matrixWorldAutoUpdate" translate="no">.<a href="#matrixWorldAutoUpdate">matrixWorldAutoUpdate</a><span class="type-signature"> : boolean</span> </h3>
  120. <div class="description">
  121. <p>When set to <code>true</code>, the engine automatically computes the world matrix from the current local
  122. matrix and the object's transformation hierarchy.</p>
  123. <p>The default values for all 3D objects is defined by <code>Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE</code>.</p>
  124. <p>Default is <code>true</code>.</p>
  125. </div>
  126. </div>
  127. <div class="member">
  128. <h3 class="name" id="matrixWorldNeedsUpdate" translate="no">.<a href="#matrixWorldNeedsUpdate">matrixWorldNeedsUpdate</a><span class="type-signature"> : boolean</span> </h3>
  129. <div class="description">
  130. <p>When set to <code>true</code>, it calculates the world matrix in that frame and resets this property
  131. to <code>false</code>.</p>
  132. <p>Default is <code>false</code>.</p>
  133. </div>
  134. </div>
  135. <div class="member">
  136. <h3 class="name" id="modelViewMatrix" translate="no">.<a href="#modelViewMatrix">modelViewMatrix</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
  137. <div class="description">
  138. <p>Represents the object's model-view matrix.</p>
  139. </div>
  140. </div>
  141. <div class="member">
  142. <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
  143. <div class="description">
  144. <p>The name of the 3D object.</p>
  145. </div>
  146. </div>
  147. <div class="member">
  148. <h3 class="name" id="normalMatrix" translate="no">.<a href="#normalMatrix">normalMatrix</a><span class="type-signature"> : <a href="Matrix3.html">Matrix3</a></span> </h3>
  149. <div class="description">
  150. <p>Represents the object's normal matrix.</p>
  151. </div>
  152. </div>
  153. <div class="member">
  154. <h3 class="name" id="parent" translate="no">.<a href="#parent">parent</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  155. <div class="description">
  156. <p>A reference to the parent object.</p>
  157. <p>Default is <code>null</code>.</p>
  158. </div>
  159. </div>
  160. <div class="member">
  161. <h3 class="name" id="position" translate="no">.<a href="#position">position</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  162. <div class="description">
  163. <p>Represents the object's local position.</p>
  164. <p>Default is <code>(0,0,0)</code>.</p>
  165. </div>
  166. </div>
  167. <div class="member">
  168. <h3 class="name" id="quaternion" translate="no">.<a href="#quaternion">quaternion</a><span class="type-signature"> : <a href="Quaternion.html">Quaternion</a></span> </h3>
  169. <div class="description">
  170. <p>Represents the object's local rotation as Quaternions.</p>
  171. </div>
  172. </div>
  173. <div class="member">
  174. <h3 class="name" id="receiveShadow" translate="no">.<a href="#receiveShadow">receiveShadow</a><span class="type-signature"> : boolean</span> </h3>
  175. <div class="description">
  176. <p>When set to <code>true</code>, the 3D object is affected by shadows in the scene.</p>
  177. <p>Default is <code>false</code>.</p>
  178. </div>
  179. </div>
  180. <div class="member">
  181. <h3 class="name" id="renderOrder" translate="no">.<a href="#renderOrder">renderOrder</a><span class="type-signature"> : number</span> </h3>
  182. <div class="description">
  183. <p>This value allows the default rendering order of scene graph objects to be
  184. overridden although opaque and transparent objects remain sorted independently.
  185. When this property is set for an instance of <a href="Group.html">Group</a>,all descendants
  186. objects will be sorted and rendered together. Sorting is from lowest to highest
  187. render order.</p>
  188. <p>Default is <code>0</code>.</p>
  189. </div>
  190. </div>
  191. <div class="member">
  192. <h3 class="name" id="rotation" translate="no">.<a href="#rotation">rotation</a><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  193. <div class="description">
  194. <p>Represents the object's local rotation as Euler angles, in radians.</p>
  195. <p>Default is <code>(0,0,0)</code>.</p>
  196. </div>
  197. </div>
  198. <div class="member">
  199. <h3 class="name" id="scale" translate="no">.<a href="#scale">scale</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  200. <div class="description">
  201. <p>Represents the object's local scale.</p>
  202. <p>Default is <code>(1,1,1)</code>.</p>
  203. </div>
  204. </div>
  205. <div class="member">
  206. <h3 class="name" id="type" translate="no">.<a href="#type">type</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  207. <div class="description">
  208. <p>The type property is used for detecting the object type
  209. in context of serialization/deserialization.</p>
  210. </div>
  211. </div>
  212. <div class="member">
  213. <h3 class="name" id="up" translate="no">.<a href="#up">up</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  214. <div class="description">
  215. <p>Defines the <code>up</code> direction of the 3D object which influences
  216. the orientation via methods like <a href="Object3D.html#lookAt">Object3D#lookAt</a>.</p>
  217. <p>The default values for all 3D objects is defined by <code>Object3D.DEFAULT_UP</code>.</p>
  218. </div>
  219. </div>
  220. <div class="member">
  221. <h3 class="name" id="userData" translate="no">.<a href="#userData">userData</a><span class="type-signature"> : Object</span> </h3>
  222. <div class="description">
  223. <p>An object that can be used to store custom data about the 3D object. It
  224. should not hold references to functions as these will not be cloned.</p>
  225. </div>
  226. </div>
  227. <div class="member">
  228. <h3 class="name" id="uuid" translate="no">.<a href="#uuid">uuid</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  229. <div class="description">
  230. <p>The UUID of the 3D object.</p>
  231. </div>
  232. </div>
  233. <div class="member">
  234. <h3 class="name" id="visible" translate="no">.<a href="#visible">visible</a><span class="type-signature"> : boolean</span> </h3>
  235. <div class="description">
  236. <p>When set to <code>true</code>, the 3D object gets rendered.</p>
  237. <p>Default is <code>true</code>.</p>
  238. </div>
  239. </div>
  240. <div class="member">
  241. <h3 class="name" id=".DEFAULT_MATRIX_AUTO_UPDATE" translate="no">.<a href="#.DEFAULT_MATRIX_AUTO_UPDATE">DEFAULT_MATRIX_AUTO_UPDATE</a><span class="type-signature"> : boolean</span> </h3>
  242. <div class="description">
  243. <p>The default setting for <a href="Object3D.html#matrixAutoUpdate">Object3D#matrixAutoUpdate</a> for
  244. newly created 3D objects.</p>
  245. <p>Default is <code>true</code>.</p>
  246. </div>
  247. </div>
  248. <div class="member">
  249. <h3 class="name" id=".DEFAULT_MATRIX_WORLD_AUTO_UPDATE" translate="no">.<a href="#.DEFAULT_MATRIX_WORLD_AUTO_UPDATE">DEFAULT_MATRIX_WORLD_AUTO_UPDATE</a><span class="type-signature"> : boolean</span> </h3>
  250. <div class="description">
  251. <p>The default setting for <a href="Object3D.html#matrixWorldAutoUpdate">Object3D#matrixWorldAutoUpdate</a> for
  252. newly created 3D objects.</p>
  253. <p>Default is <code>true</code>.</p>
  254. </div>
  255. </div>
  256. <div class="member">
  257. <h3 class="name" id=".DEFAULT_UP" translate="no">.<a href="#.DEFAULT_UP">DEFAULT_UP</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  258. <div class="description">
  259. <p>The default up direction for objects, also used as the default
  260. position for <a href="DirectionalLight.html">DirectionalLight</a> and <a href="HemisphereLight.html">HemisphereLight</a>.</p>
  261. <p>Default is <code>(0,1,0)</code>.</p>
  262. </div>
  263. </div>
  264. <h2 class="subsection-title">Methods</h2>
  265. <h3 class="name name-method" id="add" translate="no">.<a href="#add">add</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  266. <div class="method">
  267. <div class="description">
  268. <p>Adds the given 3D object as a child to this 3D object. An arbitrary number of
  269. objects may be added. Any current parent on an object passed in here will be
  270. removed, since an object can have at most one parent.</p>
  271. </div>
  272. <table class="params">
  273. <tbody>
  274. <tr>
  275. <td class="name">
  276. <strong>object</strong>
  277. </td>
  278. <td class="description last">
  279. <p>The 3D object to add.</p>
  280. </td>
  281. </tr>
  282. </tbody>
  283. </table>
  284. <h5>Fires:</h5>
  285. <ul>
  286. <li><a href="Object3D.html#event:added">Object3D#event:added</a></li>
  287. <li><a href="Object3D.html#event:childadded">Object3D#event:childadded</a></li>
  288. </ul>
  289. <dl class="details">
  290. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  291. </dl>
  292. </div>
  293. <h3 class="name name-method" id="applyMatrix4" translate="no">.<a href="#applyMatrix4">applyMatrix4</a><span class="signature">( matrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span> </h3>
  294. <div class="method">
  295. <div class="description">
  296. <p>Applies the given transformation matrix to the object and updates the object's position,
  297. rotation and scale.</p>
  298. </div>
  299. <table class="params">
  300. <tbody>
  301. <tr>
  302. <td class="name">
  303. <strong>matrix</strong>
  304. </td>
  305. <td class="description last">
  306. <p>The transformation matrix.</p>
  307. </td>
  308. </tr>
  309. </tbody>
  310. </table>
  311. </div>
  312. <h3 class="name name-method" id="applyQuaternion" translate="no">.<a href="#applyQuaternion">applyQuaternion</a><span class="signature">( q : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  313. <div class="method">
  314. <div class="description">
  315. <p>Applies a rotation represented by given the quaternion to the 3D object.</p>
  316. </div>
  317. <table class="params">
  318. <tbody>
  319. <tr>
  320. <td class="name">
  321. <strong>q</strong>
  322. </td>
  323. <td class="description last">
  324. <p>The quaternion.</p>
  325. </td>
  326. </tr>
  327. </tbody>
  328. </table>
  329. <dl class="details">
  330. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  331. </dl>
  332. </div>
  333. <h3 class="name name-method" id="attach" translate="no">.<a href="#attach">attach</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  334. <div class="method">
  335. <div class="description">
  336. <p>Adds the given 3D object as a child of this 3D object, while maintaining the object's world
  337. transform. This method does not support scene graphs having non-uniformly-scaled nodes(s).</p>
  338. </div>
  339. <table class="params">
  340. <tbody>
  341. <tr>
  342. <td class="name">
  343. <strong>object</strong>
  344. </td>
  345. <td class="description last">
  346. <p>The 3D object to attach.</p>
  347. </td>
  348. </tr>
  349. </tbody>
  350. </table>
  351. <h5>Fires:</h5>
  352. <ul>
  353. <li><a href="Object3D.html#event:added">Object3D#event:added</a></li>
  354. <li><a href="Object3D.html#event:childadded">Object3D#event:childadded</a></li>
  355. </ul>
  356. <dl class="details">
  357. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  358. </dl>
  359. </div>
  360. <h3 class="name name-method" id="clear" translate="no">.<a href="#clear">clear</a><span class="signature">()</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  361. <div class="method">
  362. <div class="description">
  363. <p>Removes all child objects.</p>
  364. </div>
  365. <h5>Fires:</h5>
  366. <ul>
  367. <li><a href="Object3D.html#event:removed">Object3D#event:removed</a></li>
  368. <li><a href="Object3D.html#event:childremoved">Object3D#event:childremoved</a></li>
  369. </ul>
  370. <dl class="details">
  371. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  372. </dl>
  373. </div>
  374. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">( recursive : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  375. <div class="method">
  376. <div class="description">
  377. <p>Returns a new 3D object with copied values from this instance.</p>
  378. </div>
  379. <table class="params">
  380. <tbody>
  381. <tr>
  382. <td class="name">
  383. <strong>recursive</strong>
  384. </td>
  385. <td class="description last">
  386. <p>When set to <code>true</code>, descendants of the 3D object are also cloned.</p>
  387. <p>Default is <code>true</code>.</p>
  388. </td>
  389. </tr>
  390. </tbody>
  391. </table>
  392. <dl class="details">
  393. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  394. </dl>
  395. </div>
  396. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( source : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, recursive : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  397. <div class="method">
  398. <div class="description">
  399. <p>Copies the values of the given 3D object to this instance.</p>
  400. </div>
  401. <table class="params">
  402. <tbody>
  403. <tr>
  404. <td class="name">
  405. <strong>source</strong>
  406. </td>
  407. <td class="description last">
  408. <p>The 3D object to copy.</p>
  409. </td>
  410. </tr>
  411. <tr>
  412. <td class="name">
  413. <strong>recursive</strong>
  414. </td>
  415. <td class="description last">
  416. <p>When set to <code>true</code>, descendants of the 3D object are cloned.</p>
  417. <p>Default is <code>true</code>.</p>
  418. </td>
  419. </tr>
  420. </tbody>
  421. </table>
  422. <dl class="details">
  423. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  424. </dl>
  425. </div>
  426. <h3 class="name name-method" id="getObjectById" translate="no">.<a href="#getObjectById">getObjectById</a><span class="signature">( id : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a> | undefined</span> </h3>
  427. <div class="method">
  428. <div class="description">
  429. <p>Searches through the 3D object and its children, starting with the 3D object
  430. itself, and returns the first with a matching ID.</p>
  431. </div>
  432. <table class="params">
  433. <tbody>
  434. <tr>
  435. <td class="name">
  436. <strong>id</strong>
  437. </td>
  438. <td class="description last">
  439. <p>The id.</p>
  440. </td>
  441. </tr>
  442. </tbody>
  443. </table>
  444. <dl class="details">
  445. <dt class="tag-returns"><strong>Returns:</strong> The found 3D object. Returns <code>undefined</code> if no 3D object has been found.</dt>
  446. </dl>
  447. </div>
  448. <h3 class="name name-method" id="getObjectByName" translate="no">.<a href="#getObjectByName">getObjectByName</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a> | undefined</span> </h3>
  449. <div class="method">
  450. <div class="description">
  451. <p>Searches through the 3D object and its children, starting with the 3D object
  452. itself, and returns the first with a matching name.</p>
  453. </div>
  454. <table class="params">
  455. <tbody>
  456. <tr>
  457. <td class="name">
  458. <strong>name</strong>
  459. </td>
  460. <td class="description last">
  461. <p>The name.</p>
  462. </td>
  463. </tr>
  464. </tbody>
  465. </table>
  466. <dl class="details">
  467. <dt class="tag-returns"><strong>Returns:</strong> The found 3D object. Returns <code>undefined</code> if no 3D object has been found.</dt>
  468. </dl>
  469. </div>
  470. <h3 class="name name-method" id="getObjectByProperty" translate="no">.<a href="#getObjectByProperty">getObjectByProperty</a><span class="signature">( name : <span class="param-type">string</span>, value : <span class="param-type"><a href="global.html#any">any</a></span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a> | undefined</span> </h3>
  471. <div class="method">
  472. <div class="description">
  473. <p>Searches through the 3D object and its children, starting with the 3D object
  474. itself, and returns the first with a matching property value.</p>
  475. </div>
  476. <table class="params">
  477. <tbody>
  478. <tr>
  479. <td class="name">
  480. <strong>name</strong>
  481. </td>
  482. <td class="description last">
  483. <p>The name of the property.</p>
  484. </td>
  485. </tr>
  486. <tr>
  487. <td class="name">
  488. <strong>value</strong>
  489. </td>
  490. <td class="description last">
  491. <p>The value.</p>
  492. </td>
  493. </tr>
  494. </tbody>
  495. </table>
  496. <dl class="details">
  497. <dt class="tag-returns"><strong>Returns:</strong> The found 3D object. Returns <code>undefined</code> if no 3D object has been found.</dt>
  498. </dl>
  499. </div>
  500. <h3 class="name name-method" id="getObjectsByProperty" translate="no">.<a href="#getObjectsByProperty">getObjectsByProperty</a><span class="signature">( name : <span class="param-type">string</span>, value : <span class="param-type"><a href="global.html#any">any</a></span>, result : <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></span> )</span><span class="type-signature"> : Array.&lt;<a href="Object3D.html">Object3D</a>></span> </h3>
  501. <div class="method">
  502. <div class="description">
  503. <p>Searches through the 3D object and its children, starting with the 3D object
  504. itself, and returns all 3D objects with a matching property value.</p>
  505. </div>
  506. <table class="params">
  507. <tbody>
  508. <tr>
  509. <td class="name">
  510. <strong>name</strong>
  511. </td>
  512. <td class="description last">
  513. <p>The name of the property.</p>
  514. </td>
  515. </tr>
  516. <tr>
  517. <td class="name">
  518. <strong>value</strong>
  519. </td>
  520. <td class="description last">
  521. <p>The value.</p>
  522. </td>
  523. </tr>
  524. <tr>
  525. <td class="name">
  526. <strong>result</strong>
  527. </td>
  528. <td class="description last">
  529. <p>The method stores the result in this array.</p>
  530. </td>
  531. </tr>
  532. </tbody>
  533. </table>
  534. <dl class="details">
  535. <dt class="tag-returns"><strong>Returns:</strong> The found 3D objects.</dt>
  536. </dl>
  537. </div>
  538. <h3 class="name name-method" id="getWorldDirection" translate="no">.<a href="#getWorldDirection">getWorldDirection</a><span class="signature">( 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>
  539. <div class="method">
  540. <div class="description">
  541. <p>Returns a vector representing the (&quot;look&quot;) direction of the 3D object in world space.</p>
  542. </div>
  543. <table class="params">
  544. <tbody>
  545. <tr>
  546. <td class="name">
  547. <strong>target</strong>
  548. </td>
  549. <td class="description last">
  550. <p>The target vector the result is stored to.</p>
  551. </td>
  552. </tr>
  553. </tbody>
  554. </table>
  555. <dl class="details">
  556. <dt class="tag-returns"><strong>Returns:</strong> The 3D object's direction in world space.</dt>
  557. </dl>
  558. </div>
  559. <h3 class="name name-method" id="getWorldPosition" translate="no">.<a href="#getWorldPosition">getWorldPosition</a><span class="signature">( 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>
  560. <div class="method">
  561. <div class="description">
  562. <p>Returns a vector representing the position of the 3D object in world space.</p>
  563. </div>
  564. <table class="params">
  565. <tbody>
  566. <tr>
  567. <td class="name">
  568. <strong>target</strong>
  569. </td>
  570. <td class="description last">
  571. <p>The target vector the result is stored to.</p>
  572. </td>
  573. </tr>
  574. </tbody>
  575. </table>
  576. <dl class="details">
  577. <dt class="tag-returns"><strong>Returns:</strong> The 3D object's position in world space.</dt>
  578. </dl>
  579. </div>
  580. <h3 class="name name-method" id="getWorldQuaternion" translate="no">.<a href="#getWorldQuaternion">getWorldQuaternion</a><span class="signature">( target : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span> )</span><span class="type-signature"> : <a href="Quaternion.html">Quaternion</a></span> </h3>
  581. <div class="method">
  582. <div class="description">
  583. <p>Returns a Quaternion representing the position of the 3D object in world space.</p>
  584. </div>
  585. <table class="params">
  586. <tbody>
  587. <tr>
  588. <td class="name">
  589. <strong>target</strong>
  590. </td>
  591. <td class="description last">
  592. <p>The target Quaternion the result is stored to.</p>
  593. </td>
  594. </tr>
  595. </tbody>
  596. </table>
  597. <dl class="details">
  598. <dt class="tag-returns"><strong>Returns:</strong> The 3D object's rotation in world space.</dt>
  599. </dl>
  600. </div>
  601. <h3 class="name name-method" id="getWorldScale" translate="no">.<a href="#getWorldScale">getWorldScale</a><span class="signature">( 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>
  602. <div class="method">
  603. <div class="description">
  604. <p>Returns a vector representing the scale of the 3D object in world space.</p>
  605. </div>
  606. <table class="params">
  607. <tbody>
  608. <tr>
  609. <td class="name">
  610. <strong>target</strong>
  611. </td>
  612. <td class="description last">
  613. <p>The target vector the result is stored to.</p>
  614. </td>
  615. </tr>
  616. </tbody>
  617. </table>
  618. <dl class="details">
  619. <dt class="tag-returns"><strong>Returns:</strong> The 3D object's scale in world space.</dt>
  620. </dl>
  621. </div>
  622. <h3 class="name name-method" id="localToWorld" translate="no">.<a href="#localToWorld">localToWorld</a><span class="signature">( vector : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  623. <div class="method">
  624. <div class="description">
  625. <p>Converts the given vector from this 3D object's local space to world space.</p>
  626. </div>
  627. <table class="params">
  628. <tbody>
  629. <tr>
  630. <td class="name">
  631. <strong>vector</strong>
  632. </td>
  633. <td class="description last">
  634. <p>The vector to convert.</p>
  635. </td>
  636. </tr>
  637. </tbody>
  638. </table>
  639. <dl class="details">
  640. <dt class="tag-returns"><strong>Returns:</strong> The converted vector.</dt>
  641. </dl>
  642. </div>
  643. <h3 class="name name-method" id="lookAt" translate="no">.<a href="#lookAt">lookAt</a><span class="signature">( x : <span class="param-type">number | <a href="Vector3.html">Vector3</a></span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span> </h3>
  644. <div class="method">
  645. <div class="description">
  646. <p>Rotates the object to face a point in world space.</p>
  647. <p>This method does not support objects having non-uniformly-scaled parent(s).</p>
  648. </div>
  649. <table class="params">
  650. <tbody>
  651. <tr>
  652. <td class="name">
  653. <strong>x</strong>
  654. </td>
  655. <td class="description last">
  656. <p>The x coordinate in world space. Alternatively, a vector representing a position in world space</p>
  657. </td>
  658. </tr>
  659. <tr>
  660. <td class="name">
  661. <strong>y</strong>
  662. </td>
  663. <td class="description last">
  664. <p>The y coordinate in world space.</p>
  665. </td>
  666. </tr>
  667. <tr>
  668. <td class="name">
  669. <strong>z</strong>
  670. </td>
  671. <td class="description last">
  672. <p>The z coordinate in world space.</p>
  673. </td>
  674. </tr>
  675. </tbody>
  676. </table>
  677. </div>
  678. <h3 class="name name-method" id="onAfterRender" translate="no">.<a href="#onAfterRender">onAfterRender</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a> | <a href="WebGLRenderer.html">WebGLRenderer</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a></span>, group : <span class="param-type">Object</span> )</span> </h3>
  679. <div class="method">
  680. <div class="description">
  681. <p>A callback that is executed immediately after a 3D object is rendered.</p>
  682. </div>
  683. <table class="params">
  684. <tbody>
  685. <tr>
  686. <td class="name">
  687. <strong>renderer</strong>
  688. </td>
  689. <td class="description last">
  690. <p>The renderer.</p>
  691. </td>
  692. </tr>
  693. <tr>
  694. <td class="name">
  695. <strong>object</strong>
  696. </td>
  697. <td class="description last">
  698. <p>The 3D object.</p>
  699. </td>
  700. </tr>
  701. <tr>
  702. <td class="name">
  703. <strong>camera</strong>
  704. </td>
  705. <td class="description last">
  706. <p>The camera that is used to render the scene.</p>
  707. </td>
  708. </tr>
  709. <tr>
  710. <td class="name">
  711. <strong>geometry</strong>
  712. </td>
  713. <td class="description last">
  714. <p>The 3D object's geometry.</p>
  715. </td>
  716. </tr>
  717. <tr>
  718. <td class="name">
  719. <strong>material</strong>
  720. </td>
  721. <td class="description last">
  722. <p>The 3D object's material.</p>
  723. </td>
  724. </tr>
  725. <tr>
  726. <td class="name">
  727. <strong>group</strong>
  728. </td>
  729. <td class="description last">
  730. <p>The geometry group data.</p>
  731. </td>
  732. </tr>
  733. </tbody>
  734. </table>
  735. </div>
  736. <h3 class="name name-method" id="onAfterShadow" translate="no">.<a href="#onAfterShadow">onAfterShadow</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a> | <a href="WebGLRenderer.html">WebGLRenderer</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, shadowCamera : <span class="param-type"><a href="Camera.html">Camera</a></span>, geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, depthMaterial : <span class="param-type"><a href="Material.html">Material</a></span>, group : <span class="param-type">Object</span> )</span> </h3>
  737. <div class="method">
  738. <div class="description">
  739. <p>A callback that is executed immediately after a 3D object is rendered to a shadow map.</p>
  740. </div>
  741. <table class="params">
  742. <tbody>
  743. <tr>
  744. <td class="name">
  745. <strong>renderer</strong>
  746. </td>
  747. <td class="description last">
  748. <p>The renderer.</p>
  749. </td>
  750. </tr>
  751. <tr>
  752. <td class="name">
  753. <strong>object</strong>
  754. </td>
  755. <td class="description last">
  756. <p>The 3D object.</p>
  757. </td>
  758. </tr>
  759. <tr>
  760. <td class="name">
  761. <strong>camera</strong>
  762. </td>
  763. <td class="description last">
  764. <p>The camera that is used to render the scene.</p>
  765. </td>
  766. </tr>
  767. <tr>
  768. <td class="name">
  769. <strong>shadowCamera</strong>
  770. </td>
  771. <td class="description last">
  772. <p>The shadow camera.</p>
  773. </td>
  774. </tr>
  775. <tr>
  776. <td class="name">
  777. <strong>geometry</strong>
  778. </td>
  779. <td class="description last">
  780. <p>The 3D object's geometry.</p>
  781. </td>
  782. </tr>
  783. <tr>
  784. <td class="name">
  785. <strong>depthMaterial</strong>
  786. </td>
  787. <td class="description last">
  788. <p>The depth material.</p>
  789. </td>
  790. </tr>
  791. <tr>
  792. <td class="name">
  793. <strong>group</strong>
  794. </td>
  795. <td class="description last">
  796. <p>The geometry group data.</p>
  797. </td>
  798. </tr>
  799. </tbody>
  800. </table>
  801. </div>
  802. <h3 class="name name-method" id="onBeforeRender" translate="no">.<a href="#onBeforeRender">onBeforeRender</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a> | <a href="WebGLRenderer.html">WebGLRenderer</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a></span>, group : <span class="param-type">Object</span> )</span> </h3>
  803. <div class="method">
  804. <div class="description">
  805. <p>A callback that is executed immediately before a 3D object is rendered.</p>
  806. </div>
  807. <table class="params">
  808. <tbody>
  809. <tr>
  810. <td class="name">
  811. <strong>renderer</strong>
  812. </td>
  813. <td class="description last">
  814. <p>The renderer.</p>
  815. </td>
  816. </tr>
  817. <tr>
  818. <td class="name">
  819. <strong>object</strong>
  820. </td>
  821. <td class="description last">
  822. <p>The 3D object.</p>
  823. </td>
  824. </tr>
  825. <tr>
  826. <td class="name">
  827. <strong>camera</strong>
  828. </td>
  829. <td class="description last">
  830. <p>The camera that is used to render the scene.</p>
  831. </td>
  832. </tr>
  833. <tr>
  834. <td class="name">
  835. <strong>geometry</strong>
  836. </td>
  837. <td class="description last">
  838. <p>The 3D object's geometry.</p>
  839. </td>
  840. </tr>
  841. <tr>
  842. <td class="name">
  843. <strong>material</strong>
  844. </td>
  845. <td class="description last">
  846. <p>The 3D object's material.</p>
  847. </td>
  848. </tr>
  849. <tr>
  850. <td class="name">
  851. <strong>group</strong>
  852. </td>
  853. <td class="description last">
  854. <p>The geometry group data.</p>
  855. </td>
  856. </tr>
  857. </tbody>
  858. </table>
  859. </div>
  860. <h3 class="name name-method" id="onBeforeShadow" translate="no">.<a href="#onBeforeShadow">onBeforeShadow</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a> | <a href="WebGLRenderer.html">WebGLRenderer</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, shadowCamera : <span class="param-type"><a href="Camera.html">Camera</a></span>, geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, depthMaterial : <span class="param-type"><a href="Material.html">Material</a></span>, group : <span class="param-type">Object</span> )</span> </h3>
  861. <div class="method">
  862. <div class="description">
  863. <p>A callback that is executed immediately before a 3D object is rendered to a shadow map.</p>
  864. </div>
  865. <table class="params">
  866. <tbody>
  867. <tr>
  868. <td class="name">
  869. <strong>renderer</strong>
  870. </td>
  871. <td class="description last">
  872. <p>The renderer.</p>
  873. </td>
  874. </tr>
  875. <tr>
  876. <td class="name">
  877. <strong>object</strong>
  878. </td>
  879. <td class="description last">
  880. <p>The 3D object.</p>
  881. </td>
  882. </tr>
  883. <tr>
  884. <td class="name">
  885. <strong>camera</strong>
  886. </td>
  887. <td class="description last">
  888. <p>The camera that is used to render the scene.</p>
  889. </td>
  890. </tr>
  891. <tr>
  892. <td class="name">
  893. <strong>shadowCamera</strong>
  894. </td>
  895. <td class="description last">
  896. <p>The shadow camera.</p>
  897. </td>
  898. </tr>
  899. <tr>
  900. <td class="name">
  901. <strong>geometry</strong>
  902. </td>
  903. <td class="description last">
  904. <p>The 3D object's geometry.</p>
  905. </td>
  906. </tr>
  907. <tr>
  908. <td class="name">
  909. <strong>depthMaterial</strong>
  910. </td>
  911. <td class="description last">
  912. <p>The depth material.</p>
  913. </td>
  914. </tr>
  915. <tr>
  916. <td class="name">
  917. <strong>group</strong>
  918. </td>
  919. <td class="description last">
  920. <p>The geometry group data.</p>
  921. </td>
  922. </tr>
  923. </tbody>
  924. </table>
  925. </div>
  926. <h3 class="name name-method" id="raycast" translate="no">.<a href="#raycast">raycast</a><span class="signature">( raycaster : <span class="param-type"><a href="Raycaster.html">Raycaster</a></span>, intersects : <span class="param-type">Array.&lt;Object></span> )</span> <span class="type-signature">(abstract) </span></h3>
  927. <div class="method">
  928. <div class="description">
  929. <p>Abstract method to get intersections between a casted ray and this
  930. 3D object. Renderable 3D objects such as <a href="Mesh.html">Mesh</a>, <a href="Line.html">Line</a> or <a href="Points.html">Points</a>
  931. implement this method in order to use raycasting.</p>
  932. </div>
  933. <table class="params">
  934. <tbody>
  935. <tr>
  936. <td class="name">
  937. <strong>raycaster</strong>
  938. </td>
  939. <td class="description last">
  940. <p>The raycaster.</p>
  941. </td>
  942. </tr>
  943. <tr>
  944. <td class="name">
  945. <strong>intersects</strong>
  946. </td>
  947. <td class="description last">
  948. <p>An array holding the result of the method.</p>
  949. </td>
  950. </tr>
  951. </tbody>
  952. </table>
  953. </div>
  954. <h3 class="name name-method" id="remove" translate="no">.<a href="#remove">remove</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  955. <div class="method">
  956. <div class="description">
  957. <p>Removes the given 3D object as child from this 3D object.
  958. An arbitrary number of objects may be removed.</p>
  959. </div>
  960. <table class="params">
  961. <tbody>
  962. <tr>
  963. <td class="name">
  964. <strong>object</strong>
  965. </td>
  966. <td class="description last">
  967. <p>The 3D object to remove.</p>
  968. </td>
  969. </tr>
  970. </tbody>
  971. </table>
  972. <h5>Fires:</h5>
  973. <ul>
  974. <li><a href="Object3D.html#event:removed">Object3D#event:removed</a></li>
  975. <li><a href="Object3D.html#event:childremoved">Object3D#event:childremoved</a></li>
  976. </ul>
  977. <dl class="details">
  978. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  979. </dl>
  980. </div>
  981. <h3 class="name name-method" id="removeFromParent" translate="no">.<a href="#removeFromParent">removeFromParent</a><span class="signature">()</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  982. <div class="method">
  983. <div class="description">
  984. <p>Removes this 3D object from its current parent.</p>
  985. </div>
  986. <h5>Fires:</h5>
  987. <ul>
  988. <li><a href="Object3D.html#event:removed">Object3D#event:removed</a></li>
  989. <li><a href="Object3D.html#event:childremoved">Object3D#event:childremoved</a></li>
  990. </ul>
  991. <dl class="details">
  992. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  993. </dl>
  994. </div>
  995. <h3 class="name name-method" id="rotateOnAxis" translate="no">.<a href="#rotateOnAxis">rotateOnAxis</a><span class="signature">( axis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  996. <div class="method">
  997. <div class="description">
  998. <p>Rotates the 3D object along an axis in local space.</p>
  999. </div>
  1000. <table class="params">
  1001. <tbody>
  1002. <tr>
  1003. <td class="name">
  1004. <strong>axis</strong>
  1005. </td>
  1006. <td class="description last">
  1007. <p>The (normalized) axis vector.</p>
  1008. </td>
  1009. </tr>
  1010. <tr>
  1011. <td class="name">
  1012. <strong>angle</strong>
  1013. </td>
  1014. <td class="description last">
  1015. <p>The angle in radians.</p>
  1016. </td>
  1017. </tr>
  1018. </tbody>
  1019. </table>
  1020. <dl class="details">
  1021. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1022. </dl>
  1023. </div>
  1024. <h3 class="name name-method" id="rotateOnWorldAxis" translate="no">.<a href="#rotateOnWorldAxis">rotateOnWorldAxis</a><span class="signature">( axis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1025. <div class="method">
  1026. <div class="description">
  1027. <p>Rotates the 3D object along an axis in world space.</p>
  1028. </div>
  1029. <table class="params">
  1030. <tbody>
  1031. <tr>
  1032. <td class="name">
  1033. <strong>axis</strong>
  1034. </td>
  1035. <td class="description last">
  1036. <p>The (normalized) axis vector.</p>
  1037. </td>
  1038. </tr>
  1039. <tr>
  1040. <td class="name">
  1041. <strong>angle</strong>
  1042. </td>
  1043. <td class="description last">
  1044. <p>The angle in radians.</p>
  1045. </td>
  1046. </tr>
  1047. </tbody>
  1048. </table>
  1049. <dl class="details">
  1050. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1051. </dl>
  1052. </div>
  1053. <h3 class="name name-method" id="rotateX" translate="no">.<a href="#rotateX">rotateX</a><span class="signature">( angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1054. <div class="method">
  1055. <div class="description">
  1056. <p>Rotates the 3D object around its X axis in local space.</p>
  1057. </div>
  1058. <table class="params">
  1059. <tbody>
  1060. <tr>
  1061. <td class="name">
  1062. <strong>angle</strong>
  1063. </td>
  1064. <td class="description last">
  1065. <p>The angle in radians.</p>
  1066. </td>
  1067. </tr>
  1068. </tbody>
  1069. </table>
  1070. <dl class="details">
  1071. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1072. </dl>
  1073. </div>
  1074. <h3 class="name name-method" id="rotateY" translate="no">.<a href="#rotateY">rotateY</a><span class="signature">( angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1075. <div class="method">
  1076. <div class="description">
  1077. <p>Rotates the 3D object around its Y axis in local space.</p>
  1078. </div>
  1079. <table class="params">
  1080. <tbody>
  1081. <tr>
  1082. <td class="name">
  1083. <strong>angle</strong>
  1084. </td>
  1085. <td class="description last">
  1086. <p>The angle in radians.</p>
  1087. </td>
  1088. </tr>
  1089. </tbody>
  1090. </table>
  1091. <dl class="details">
  1092. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1093. </dl>
  1094. </div>
  1095. <h3 class="name name-method" id="rotateZ" translate="no">.<a href="#rotateZ">rotateZ</a><span class="signature">( angle : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1096. <div class="method">
  1097. <div class="description">
  1098. <p>Rotates the 3D object around its Z axis in local space.</p>
  1099. </div>
  1100. <table class="params">
  1101. <tbody>
  1102. <tr>
  1103. <td class="name">
  1104. <strong>angle</strong>
  1105. </td>
  1106. <td class="description last">
  1107. <p>The angle in radians.</p>
  1108. </td>
  1109. </tr>
  1110. </tbody>
  1111. </table>
  1112. <dl class="details">
  1113. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1114. </dl>
  1115. </div>
  1116. <h3 class="name name-method" id="setRotationFromAxisAngle" translate="no">.<a href="#setRotationFromAxisAngle">setRotationFromAxisAngle</a><span class="signature">( axis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, angle : <span class="param-type">number</span> )</span> </h3>
  1117. <div class="method">
  1118. <div class="description">
  1119. <p>Sets the given rotation represented as an axis/angle couple to the 3D object.</p>
  1120. </div>
  1121. <table class="params">
  1122. <tbody>
  1123. <tr>
  1124. <td class="name">
  1125. <strong>axis</strong>
  1126. </td>
  1127. <td class="description last">
  1128. <p>The (normalized) axis vector.</p>
  1129. </td>
  1130. </tr>
  1131. <tr>
  1132. <td class="name">
  1133. <strong>angle</strong>
  1134. </td>
  1135. <td class="description last">
  1136. <p>The angle in radians.</p>
  1137. </td>
  1138. </tr>
  1139. </tbody>
  1140. </table>
  1141. </div>
  1142. <h3 class="name name-method" id="setRotationFromEuler" translate="no">.<a href="#setRotationFromEuler">setRotationFromEuler</a><span class="signature">( euler : <span class="param-type"><a href="Euler.html">Euler</a></span> )</span> </h3>
  1143. <div class="method">
  1144. <div class="description">
  1145. <p>Sets the given rotation represented as Euler angles to the 3D object.</p>
  1146. </div>
  1147. <table class="params">
  1148. <tbody>
  1149. <tr>
  1150. <td class="name">
  1151. <strong>euler</strong>
  1152. </td>
  1153. <td class="description last">
  1154. <p>The Euler angles.</p>
  1155. </td>
  1156. </tr>
  1157. </tbody>
  1158. </table>
  1159. </div>
  1160. <h3 class="name name-method" id="setRotationFromMatrix" translate="no">.<a href="#setRotationFromMatrix">setRotationFromMatrix</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span> </h3>
  1161. <div class="method">
  1162. <div class="description">
  1163. <p>Sets the given rotation represented as rotation matrix to the 3D object.</p>
  1164. </div>
  1165. <table class="params">
  1166. <tbody>
  1167. <tr>
  1168. <td class="name">
  1169. <strong>m</strong>
  1170. </td>
  1171. <td class="description last">
  1172. <p>Although a 4x4 matrix is expected, the upper 3x3 portion must be
  1173. a pure rotation matrix (i.e, unscaled).</p>
  1174. </td>
  1175. </tr>
  1176. </tbody>
  1177. </table>
  1178. </div>
  1179. <h3 class="name name-method" id="setRotationFromQuaternion" translate="no">.<a href="#setRotationFromQuaternion">setRotationFromQuaternion</a><span class="signature">( q : <span class="param-type"><a href="Quaternion.html">Quaternion</a></span> )</span> </h3>
  1180. <div class="method">
  1181. <div class="description">
  1182. <p>Sets the given rotation represented as a Quaternion to the 3D object.</p>
  1183. </div>
  1184. <table class="params">
  1185. <tbody>
  1186. <tr>
  1187. <td class="name">
  1188. <strong>q</strong>
  1189. </td>
  1190. <td class="description last">
  1191. <p>The Quaternion</p>
  1192. </td>
  1193. </tr>
  1194. </tbody>
  1195. </table>
  1196. </div>
  1197. <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">( meta : <span class="param-type">Object | string</span> )</span><span class="type-signature"> : Object</span> </h3>
  1198. <div class="method">
  1199. <div class="description">
  1200. <p>Serializes the 3D object into JSON.</p>
  1201. </div>
  1202. <table class="params">
  1203. <tbody>
  1204. <tr>
  1205. <td class="name">
  1206. <strong>meta</strong>
  1207. </td>
  1208. <td class="description last">
  1209. <p>An optional value holding meta information about the serialization.</p>
  1210. </td>
  1211. </tr>
  1212. </tbody>
  1213. </table>
  1214. <dl class="details">
  1215. <dt class="tag-see">See:</dt>
  1216. <dd class="tag-see">
  1217. <ul>
  1218. <li><a href="ObjectLoader.html#parse">ObjectLoader#parse</a></li>
  1219. </ul>
  1220. </dd>
  1221. </dl>
  1222. <dl class="details">
  1223. <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized 3D object.</dt>
  1224. </dl>
  1225. </div>
  1226. <h3 class="name name-method" id="translateOnAxis" translate="no">.<a href="#translateOnAxis">translateOnAxis</a><span class="signature">( axis : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, distance : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1227. <div class="method">
  1228. <div class="description">
  1229. <p>Translate the 3D object by a distance along the given axis in local space.</p>
  1230. </div>
  1231. <table class="params">
  1232. <tbody>
  1233. <tr>
  1234. <td class="name">
  1235. <strong>axis</strong>
  1236. </td>
  1237. <td class="description last">
  1238. <p>The (normalized) axis vector.</p>
  1239. </td>
  1240. </tr>
  1241. <tr>
  1242. <td class="name">
  1243. <strong>distance</strong>
  1244. </td>
  1245. <td class="description last">
  1246. <p>The distance in world units.</p>
  1247. </td>
  1248. </tr>
  1249. </tbody>
  1250. </table>
  1251. <dl class="details">
  1252. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1253. </dl>
  1254. </div>
  1255. <h3 class="name name-method" id="translateX" translate="no">.<a href="#translateX">translateX</a><span class="signature">( distance : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1256. <div class="method">
  1257. <div class="description">
  1258. <p>Translate the 3D object by a distance along its X-axis in local space.</p>
  1259. </div>
  1260. <table class="params">
  1261. <tbody>
  1262. <tr>
  1263. <td class="name">
  1264. <strong>distance</strong>
  1265. </td>
  1266. <td class="description last">
  1267. <p>The distance in world units.</p>
  1268. </td>
  1269. </tr>
  1270. </tbody>
  1271. </table>
  1272. <dl class="details">
  1273. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1274. </dl>
  1275. </div>
  1276. <h3 class="name name-method" id="translateY" translate="no">.<a href="#translateY">translateY</a><span class="signature">( distance : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1277. <div class="method">
  1278. <div class="description">
  1279. <p>Translate the 3D object by a distance along its Y-axis in local space.</p>
  1280. </div>
  1281. <table class="params">
  1282. <tbody>
  1283. <tr>
  1284. <td class="name">
  1285. <strong>distance</strong>
  1286. </td>
  1287. <td class="description last">
  1288. <p>The distance in world units.</p>
  1289. </td>
  1290. </tr>
  1291. </tbody>
  1292. </table>
  1293. <dl class="details">
  1294. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1295. </dl>
  1296. </div>
  1297. <h3 class="name name-method" id="translateZ" translate="no">.<a href="#translateZ">translateZ</a><span class="signature">( distance : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  1298. <div class="method">
  1299. <div class="description">
  1300. <p>Translate the 3D object by a distance along its Z-axis in local space.</p>
  1301. </div>
  1302. <table class="params">
  1303. <tbody>
  1304. <tr>
  1305. <td class="name">
  1306. <strong>distance</strong>
  1307. </td>
  1308. <td class="description last">
  1309. <p>The distance in world units.</p>
  1310. </td>
  1311. </tr>
  1312. </tbody>
  1313. </table>
  1314. <dl class="details">
  1315. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  1316. </dl>
  1317. </div>
  1318. <h3 class="name name-method" id="traverse" translate="no">.<a href="#traverse">traverse</a><span class="signature">( callback : <span class="param-type">function</span> )</span> </h3>
  1319. <div class="method">
  1320. <div class="description">
  1321. <p>Executes the callback on this 3D object and all descendants.</p>
  1322. <p>Note: Modifying the scene graph inside the callback is discouraged.</p>
  1323. </div>
  1324. <table class="params">
  1325. <tbody>
  1326. <tr>
  1327. <td class="name">
  1328. <strong>callback</strong>
  1329. </td>
  1330. <td class="description last">
  1331. <p>A callback function that allows to process the current 3D object.</p>
  1332. </td>
  1333. </tr>
  1334. </tbody>
  1335. </table>
  1336. </div>
  1337. <h3 class="name name-method" id="traverseAncestors" translate="no">.<a href="#traverseAncestors">traverseAncestors</a><span class="signature">( callback : <span class="param-type">function</span> )</span> </h3>
  1338. <div class="method">
  1339. <div class="description">
  1340. <p>Like <a href="Object3D.html#traverse">Object3D#traverse</a>, but the callback will only be executed for all ancestors.</p>
  1341. <p>Note: Modifying the scene graph inside the callback is discouraged.</p>
  1342. </div>
  1343. <table class="params">
  1344. <tbody>
  1345. <tr>
  1346. <td class="name">
  1347. <strong>callback</strong>
  1348. </td>
  1349. <td class="description last">
  1350. <p>A callback function that allows to process the current 3D object.</p>
  1351. </td>
  1352. </tr>
  1353. </tbody>
  1354. </table>
  1355. </div>
  1356. <h3 class="name name-method" id="traverseVisible" translate="no">.<a href="#traverseVisible">traverseVisible</a><span class="signature">( callback : <span class="param-type">function</span> )</span> </h3>
  1357. <div class="method">
  1358. <div class="description">
  1359. <p>Like <a href="Object3D.html#traverse">Object3D#traverse</a>, but the callback will only be executed for visible 3D objects.
  1360. Descendants of invisible 3D objects are not traversed.</p>
  1361. <p>Note: Modifying the scene graph inside the callback is discouraged.</p>
  1362. </div>
  1363. <table class="params">
  1364. <tbody>
  1365. <tr>
  1366. <td class="name">
  1367. <strong>callback</strong>
  1368. </td>
  1369. <td class="description last">
  1370. <p>A callback function that allows to process the current 3D object.</p>
  1371. </td>
  1372. </tr>
  1373. </tbody>
  1374. </table>
  1375. </div>
  1376. <h3 class="name name-method" id="updateMatrix" translate="no">.<a href="#updateMatrix">updateMatrix</a><span class="signature">()</span> </h3>
  1377. <div class="method">
  1378. <div class="description">
  1379. <p>Updates the transformation matrix in local space by computing it from the current
  1380. position, rotation and scale values.</p>
  1381. </div>
  1382. </div>
  1383. <h3 class="name name-method" id="updateMatrixWorld" translate="no">.<a href="#updateMatrixWorld">updateMatrixWorld</a><span class="signature">( force : <span class="param-type">boolean</span> )</span> </h3>
  1384. <div class="method">
  1385. <div class="description">
  1386. <p>Updates the transformation matrix in world space of this 3D objects and its descendants.</p>
  1387. <p>To ensure correct results, this method also recomputes the 3D object's transformation matrix in
  1388. local space. The computation of the local and world matrix can be controlled with the
  1389. <a href="Object3D.html#matrixAutoUpdate">Object3D#matrixAutoUpdate</a> and <a href="Object3D.html#matrixWorldAutoUpdate">Object3D#matrixWorldAutoUpdate</a> flags which are both
  1390. <code>true</code> by default. Set these flags to <code>false</code> if you need more control over the update matrix process.</p>
  1391. </div>
  1392. <table class="params">
  1393. <tbody>
  1394. <tr>
  1395. <td class="name">
  1396. <strong>force</strong>
  1397. </td>
  1398. <td class="description last">
  1399. <p>When set to <code>true</code>, a recomputation of world matrices is forced even
  1400. when <a href="Object3D.html#matrixWorldAutoUpdate">Object3D#matrixWorldAutoUpdate</a> is set to <code>false</code>.</p>
  1401. <p>Default is <code>false</code>.</p>
  1402. </td>
  1403. </tr>
  1404. </tbody>
  1405. </table>
  1406. </div>
  1407. <h3 class="name name-method" id="updateWorldMatrix" translate="no">.<a href="#updateWorldMatrix">updateWorldMatrix</a><span class="signature">( updateParents : <span class="param-type">boolean</span>, updateChildren : <span class="param-type">boolean</span> )</span> </h3>
  1408. <div class="method">
  1409. <div class="description">
  1410. <p>An alternative version of <a href="Object3D.html#updateMatrixWorld">Object3D#updateMatrixWorld</a> with more control over the
  1411. update of ancestor and descendant nodes.</p>
  1412. </div>
  1413. <table class="params">
  1414. <tbody>
  1415. <tr>
  1416. <td class="name">
  1417. <strong>updateParents</strong>
  1418. </td>
  1419. <td class="description last">
  1420. <p>Whether ancestor nodes should be updated or not.</p>
  1421. <p>Default is <code>false</code>.</p>
  1422. </td>
  1423. </tr>
  1424. <tr>
  1425. <td class="name">
  1426. <strong>updateChildren</strong>
  1427. </td>
  1428. <td class="description last">
  1429. <p>Whether descendant nodes should be updated or not.</p>
  1430. <p>Default is <code>false</code>.</p>
  1431. </td>
  1432. </tr>
  1433. </tbody>
  1434. </table>
  1435. </div>
  1436. <h3 class="name name-method" id="worldToLocal" translate="no">.<a href="#worldToLocal">worldToLocal</a><span class="signature">( vector : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  1437. <div class="method">
  1438. <div class="description">
  1439. <p>Converts the given vector from this 3D object's word space to local space.</p>
  1440. </div>
  1441. <table class="params">
  1442. <tbody>
  1443. <tr>
  1444. <td class="name">
  1445. <strong>vector</strong>
  1446. </td>
  1447. <td class="description last">
  1448. <p>The vector to convert.</p>
  1449. </td>
  1450. </tr>
  1451. </tbody>
  1452. </table>
  1453. <dl class="details">
  1454. <dt class="tag-returns"><strong>Returns:</strong> The converted vector.</dt>
  1455. </dl>
  1456. </div>
  1457. <h2 class="subsection-title">Events</h2>
  1458. <h3 class="name name-method" id="event:added" translate="no">.<a href="#event:added">added</a> </h3>
  1459. <div class="method">
  1460. <div class="description">
  1461. <p>Fires when the object has been added to its parent object.</p>
  1462. </div>
  1463. <h5>Type:</h5>
  1464. <ul>
  1465. <li>
  1466. <span class="param-type">Object</span>
  1467. </li>
  1468. </ul>
  1469. </div>
  1470. <h3 class="name name-method" id="event:childadded" translate="no">.<a href="#event:childadded">childadded</a> </h3>
  1471. <div class="method">
  1472. <div class="description">
  1473. <p>Fires when a new child object has been added.</p>
  1474. </div>
  1475. <h5>Type:</h5>
  1476. <ul>
  1477. <li>
  1478. <span class="param-type">Object</span>
  1479. </li>
  1480. </ul>
  1481. </div>
  1482. <h3 class="name name-method" id="event:childremoved" translate="no">.<a href="#event:childremoved">childremoved</a> </h3>
  1483. <div class="method">
  1484. <div class="description">
  1485. <p>Fires when a child object has been removed.</p>
  1486. </div>
  1487. <h5>Type:</h5>
  1488. <ul>
  1489. <li>
  1490. <span class="param-type">Object</span>
  1491. </li>
  1492. </ul>
  1493. </div>
  1494. <h3 class="name name-method" id="event:removed" translate="no">.<a href="#event:removed">removed</a> </h3>
  1495. <div class="method">
  1496. <div class="description">
  1497. <p>Fires when the object has been removed from its parent object.</p>
  1498. </div>
  1499. <h5>Type:</h5>
  1500. <ul>
  1501. <li>
  1502. <span class="param-type">Object</span>
  1503. </li>
  1504. </ul>
  1505. </div>
  1506. <h2 class="subsection-title">Source</h2>
  1507. <p>
  1508. <a href="https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js" translate="no" target="_blank" rel="noopener">src/core/Object3D.js</a>
  1509. </p>
  1510. </article>
  1511. </section>
  1512. <script src="../scripts/linenumber.js"></script>
  1513. <script src="../scripts/page.js"></script>
  1514. </body>
  1515. </html>
粤ICP备19079148号