Object3D.html 65 KB

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