forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject3D.html
More file actions
378 lines (317 loc) · 10.1 KB
/
Object3D.html
File metadata and controls
378 lines (317 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">Base class for scene graph objects.</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
The constructor takes no arguments.
</div>
<h2>Properties</h2>
<h3>[property:Integer id]</h3>
<div>
readonly – Unique number for this object instance.
</div>
<h3>[property:String uuid]</h3>
<div>
[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
This gets automatically assigned, so this shouldn't be edited.
</div>
<h3>[property:String name]</h3>
<div>
Optional name of the object (doesn't need to be unique).
</div>
<h3>[property:Object3D parent]</h3>
<div>
Object's parent in the scene graph.
</div>
<h3>[property:Object3D children]</h3>
<div>
Array with object's children.
</div>
<h3>[property:Vector3 position]</h3>
<div>
Object's local position.
</div>
<h3>[property:Euler rotation]</h3>
<div>
Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles" target="_blank">Euler angles</a>), in radians.
</div>
<h3>[property:Vector3 scale]</h3>
<div>
Object's local scale.
</div>
<h3>[property:Vector3 up]</h3>
<div>
Up direction. Default is THREE.Vector3( 0, 1, 0 ).
</div>
<h3>[property:Matrix4 matrix]</h3>
<div>
Local transform.
</div>
<h3>[property:Quaternion quaternion]</h3>
<div>
Object's local rotation as [page:Quaternion Quaternion].
</div>
<h3>[property:Boolean visible]</h3>
<div>
Object gets rendered if *true*.
</div>
<div>
default – true
</div>
<h3>[property:Boolean castShadow]</h3>
<div>
Gets rendered into shadow map.
</div>
<div>
default – false
</div>
<h3>[property:Boolean receiveShadow]</h3>
<div>
Material gets baked in shadow receiving.
</div>
<div>
default – false
</div>
<h3>[property:Boolean frustumCulled]</h3>
<div>
When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible.
</div>
<div>
default – true
</div>
<h3>[property:Boolean matrixAutoUpdate]</h3>
<div>
When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.
</div>
<div>
default – true
</div>
<h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
<div>
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
</div>
<div>
default – false
</div>
<h3>[property:object userData]</h3>
<div>
An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.
</div>
<h3>[property:Matrix4 matrixWorld]</h3>
<div>
The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.
</div>
<h3>[property:function onBeforeRender]</h3>
<div>
An optional callback that is executed immediately before the Object3D is rendered. This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
</div>
<h3>[property:function onAfterRender]</h3>
<div>
An optional callback that is executed immediately after the Object3D is rendered. This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
</div>
<h2>Methods</h2>
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
<h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
<div>
matrix - matrix
</div>
<div>
This updates the position, rotation and scale with the matrix.
</div>
<h3>[method:null translateX]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along x axis by distance.
</div>
<h3>[method:null translateY]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along y axis by distance.
</div>
<h3>[method:null translateZ]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along z axis by distance.
</div>
<h3>[method:null rotateX]( [page:Float rad] )</h3>
<div>
rad - the angle to rotate in radians.<br />
</div>
<div>
Rotates the object around x axis in local space.
</div>
<h3>[method:null rotateY]( [page:Float rad] )</h3>
<div>
rad - the angle to rotate in radians.<br />
</div>
<div>
Rotates the object around y axis in local space.
</div>
<h3>[method:null rotateZ]( [page:Float rad] )</h3>
<div>
rad - the angle to rotate in radians.<br />
</div>
<div>
Rotates the object around z axis in local space.
</div>
<h3>[method:Vector3 localToWorld]( [page:Vector3 vector] )</h3>
<div>
vector - A local vector.<br />
</div>
<div>
Updates the vector from local space to world space.
</div>
<h3>[method:Vector3 worldToLocal]( [page:Vector3 vector] )</h3>
<div>
vector - A world vector.<br />
</div>
<div>
Updates the vector from world space to local space.
</div>
<h3>[method:null lookAt]( [page:Vector3 vector] )</h3>
<div>
vector - A world vector to look at.<br />
</div>
<div>
Rotates object to face point in space.
</div>
<h3>[method:null add]( [page:Object3D object], ... )</h3>
<div>
object - An object.<br />
</div>
<div>
Adds *object* as child of this object. An arbitrary number of objects may be added.
</div>
<h3>[method:null remove]( [page:Object3D object], ... )</h3>
<div>
object - An object.<br />
</div>
<div>
Removes *object* as child of this object. An arbitrary number of objects may be removed.
</div>
<h3>[method:null traverse]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Executes the callback on this object and all descendants.
</div>
<h3>[method:null traverseVisible]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Like traverse, but the callback will only be executed for visible objects.
Descendants of invisible objects are not traversed.
</div>
<h3>[method:null traverseAncestors]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Executes the callback on all ancestors.
</div>
<h3>[method:null updateMatrix]()</h3>
<div>
Updates local transform.
</div>
<h3>[method:null updateMatrixWorld]( [page:Boolean force] )</h3>
<div>
Updates global transform of the object and its children.
</div>
<h3>[method:Object3D clone]( [page:Boolean recursive] )</h3>
<div>
recursive -- if true, descendants of the object are also cloned. Default is true.
</div>
<div>
Returns a clone of this object and optionaly all descendants.
</div>
<h3>[method:Object3D getObjectByName]( [page:String name] )</h3>
<div>
name -- String to match to the children's Object3d.name property. <br />
</div>
<div>
Searches through the object's children and returns the first with a matching name.
</div>
<h3>[method:Object3D getObjectById]( [page:Integer id] )</h3>
<div>
id -- Unique number of the object instance<br />
</div>
<div>
Searches through the object's children and returns the first with a matching id.
</div>
<h3>[method:Vector3 getWorldPosition]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget — Optional target to set the result. Otherwise, a new `Vector3` is instantiated. (optional)<br />
</div>
<div>
Returns a vector representing the position of the object in world space.
</div>
<h3>[method:Quaternion getWorldQuaternion]( [page:Quaternion optionalTarget] )</h3>
<div>
optionalTarget — Optional target to set the result. Otherwise, a new `Quaternion` is instantiated. (optional)<br />
</div>
<div>
Returns a quaternion representing the rotation of the object in world space.
</div>
<h3>[method:Euler getWorldRotation]( [page:Euler optionalTarget] )</h3>
<div>
optionalTarget — Optional target to set the result. Otherwise, a new `Euler` is instantiated. (optional)<br />
</div>
<div>
Returns the euler angles representing the rotation of the object in world space.
</div>
<h3>[method:Vector3 getWorldScale]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget — Optional target to set the result. Otherwise, a new `Vector3` is instantiated. (optional)<br />
</div>
<div>
Returns a vector of the scaling factors applied to the object for each axis in world space.
</div>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget — Optional target to set the result. Otherwise, a new `Vector3` is instantiated. (optional)<br />
</div>
<div>
Returns a vector representing the direction of object's positive z-axis in world space.
</div>
<h3>[method:Object3D translateOnAxis]( [page:Vector3 axis], [page:Float distance] )</h3>
<div>
axis -- A normalized vector in object space.<br />
distance -- The distance to translate.
</div>
<div>
Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Object3D rotateOnAxis]( [page:Vector3 axis], [page:Float angle] )</h3>
<div>
axis -- A normalized vector in object space. <br />
angle -- The angle in radians.
</div>
<div>
Rotate an object along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
<div>
Abstract method to get intersections between a casted ray and this object. Subclasses such as [page:Mesh], [page:Line], and [page:Points] implement this method in order to participate in raycasting.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>