Object3D.html 6.9 KB
Newer Older
1 2 3
<!DOCTYPE html>
<html lang="en">
	<head>
4
		<meta charset="utf-8" />
5 6 7 8 9 10 11
		<script src="../../list.js"></script>
		<script src="../../page.js"></script>
		<link type="text/css" rel="stylesheet" href="../../page.css" />
	</head>
	<body>
		<h1>[name]</h1>

Y
Yuri Feldman 已提交
12
		<div class="desc">Base class for scene graph objects.</div>
13 14 15 16


		<h2>Constructor</h2>

C
cjshannon 已提交
17

18
		<h3>[name]()</h3>
C
cjshannon 已提交
19
		<div>
G
Greg Tatum 已提交
20
		The constructor takes no arguments.
C
cjshannon 已提交
21
		</div>
22 23 24 25


		<h2>Properties</h2>

26
		<h3>[property:Integer id]</h3>
27
		<div>
M
Mr.doob 已提交
28
		Unique number for this object instance.
G
gero3 已提交
29
		</div>
30

31
		<h3>[property:String uuid]</h3>
G
gero3 已提交
32
		<div>
33
		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
G
gero3 已提交
34
		This gets automatically assigned, so this shouldn't be edited.
35 36
		</div>

37
		<h3>[property:String name]</h3>
38
		<div>
S
sole 已提交
39
		Optional name of the object (doesn't need to be unique).
40
		</div>
M
Mr.doob 已提交
41

42
		<h3>[property:Object3D parent]</h3>
43
		<div>
S
sole 已提交
44
		Object's parent in the scene graph.
45
		</div>
M
Mr.doob 已提交
46

47
		<h3>[property:Object3D children]</h3>
48 49 50 51
		<div>
		Array with object's children.
		</div>

52
		<h3>[property:Vector3 position]</h3>
53 54 55 56
		<div>
		Object's local position.
		</div>

57
		<h3>[property:Euler rotation]</h3>
58
		<div>
G
Greg Tatum 已提交
59
		Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles" target="_blank">Euler angles</a>), in radians.
60 61
		</div>

62
		<h3>[property:String eulerOrder]</h3>
63 64 65 66
		<div>
		Order of axis for Euler angles.
		</div>

67
		<h3>[property:Vector3 scale]</h3>
68 69 70 71
		<div>
		Object's local scale.
		</div>

72
		<h3>[property:Vector3 up]</h3>
73 74 75 76
		<div>
		Up direction.
		</div>

77
		<h3>[property:Matrix4 matrix]</h3>
78 79 80 81
		<div>
		Local transform.
		</div>

82
		<h3>[property:Quaternion quaternion]</h3>
83
		<div>
84
		Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
85 86
		</div>

87
		<h3>[property:Boolean useQuaternion]</h3>
88 89 90 91
		<div>
		Use quaternion instead of Euler angles for specifying local rotation.
		</div>

92
		<h3>[property:Boolean visible]</h3>
93 94 95 96
		<div>
		Object gets rendered if *true*.
		</div>

97
		<h3>[property:Boolean castShadow]</h3>
98 99 100 101
		<div>
		Gets rendered into shadow map.
		</div>

102
		<h3>[property:Boolean receiveShadow]</h3>
103 104 105 106
		<div>
		Material gets baked in shadow receiving.
		</div>

107
		<h3>[property:Boolean frustumCulled]</h3>
108 109 110
		<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>
111

112
		<h3>[property:Boolean matrixAutoUpdate]</h3>
113 114 115
		<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>
116

117
		<h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
118 119 120
		<div>
		When this is set, it calculates the matrixWorld in that frame and resets this property to false.
		</div>
121

122
		<h3>[property:Boolean rotationAutoUpdate]</h3>
123 124 125
		<div>
		When this is set, then the rotationMatrix gets calculated every frame.
		</div>
126

127
		<h3>[property:object userData]</h3>
C
cjshannon 已提交
128
		<div>
G
Greg Tatum 已提交
129
		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.
130
		</div>
C
cjshannon 已提交
131

132
		<h3>[property:Matrix4 matrixWorld]</h3>
C
cjshannon 已提交
133
		<div>
G
Greg Tatum 已提交
134
		The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.
135 136
		</div>

C
cjshannon 已提交
137

138
		<h2>Methods</h2>
139

G
Greg Tatum 已提交
140
		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
141

142
		<h3>[method:null applyMatrix]( [page:Matrix4 matrix])</h3>
143 144 145 146 147 148
		<div>
		matrix - matrix
		</div>
		<div>
		This updates the position, rotation and scale with the matrix.
		</div>
149

150
		<h3>[method:null translateX]( [page:Float distance] )</h3>
151
		<div>
152 153 154
		distance - Distance.<br />
		</div>
		<div>
155 156 157
		Translates object along x axis by distance.
		</div>

158
		<h3>[method:null translateY]( [page:Float distance] )</h3>
159
		<div>
160 161 162
		distance - Distance.<br />
		</div>
		<div>
163 164 165
		Translates object along y axis by distance.
		</div>

166
		<h3>[method:null translateZ]( [page:Float distance] )</h3>
167
		<div>
168 169 170
		distance - Distance.<br />
		</div>
		<div>
171 172
		Translates object along z axis by distance.
		</div>
173

174
		<h3>[method:Vector3 localToWorld]( [page:Vector3 vector] )</h3>
175 176 177 178 179 180 181
		<div>
		vector - A local vector.<br />
		</div>
		<div>
		Updates the vector from local space to world space.
		</div>

182
		<h3>[method:Vector3 worldToLocal]( [page:Vector3 vector] )</h3>
183 184 185 186 187 188
		<div>
		vector - A world vector.<br />
		</div>
		<div>
		Updates the vector from world space to local space.
		</div>
189

190
		<h3>[method:null lookAt]( [page:Vector3 vector] )</h3>
191
		<div>
192 193 194
		vector - A world vector to look at.<br />
		</div>
		<div>
195 196 197
		Rotates object to face point in space.
		</div>

198
		<h3>[method:null add]( [page:Object3D object] )</h3>
199
		<div>
200 201 202
		object - An object.<br />
		</div>
		<div>
203 204 205
		Adds *object* as child of this object.
		</div>

206
		<h3>[method:null remove]( [page:Object3D object] )</h3>
207
		<div>
208 209 210
		object - An object.<br />
		</div>
		<div>
211 212 213
		Removes *object* as child of this object.
		</div>

214
		<h3>[method:null traverse]( [page:Function callback] )</h3>
215 216 217 218
		<div>
		callback - An Function with as first argument an object3D object.<br />
		</div>
		<div>
219
		Executes the callback on this object and all descendants.
220 221
		</div>

222
		<h3>[method:null updateMatrix]()</h3>
223 224 225 226
		<div>
		Updates local transform.
		</div>

227
		<h3>[method:null updateMatrixWorld]( [page:Boolean force] )</h3>
228 229 230 231
		<div>
		Updates global transform of the object and its children.
		</div>

232
		<h3>[method:Object3D clone]()</h3>
233 234 235 236
		<div>
		Creates a new clone of this object and all descendants.
		</div>

237

238
		<h3>[method:Object3D getObjectByName]([page:String name], [page:Boolean recursive])</h3>
C
cjshannon 已提交
239
		<div>
G
Greg Tatum 已提交
240 241
		name -- String to match to the children's Object3d.name property. <br />
		recursive -- Boolean whether to search through the children's children. Default is false.
C
cjshannon 已提交
242 243
		</div>
		<div>
G
Greg Tatum 已提交
244
		Searches through the object's children and returns the first with a matching name, optionally recursive.
C
cjshannon 已提交
245 246
		</div>

247
		<h3>[method:Object3D getObjectById]([page:Integer id], [page:Boolean recursive])</h3>
C
cjshannon 已提交
248
		<div>
G
Greg Tatum 已提交
249 250
		id -- Unique number of the object instance<br />
		recursive -- Boolean whether to search through the children's children. Default is false.
C
cjshannon 已提交
251 252
		</div>
		<div>
G
Greg Tatum 已提交
253
		Searches through the object's children and returns the first with a matching id, optionally recursive.
C
cjshannon 已提交
254
		</div>
255

256
		<h3>[method:Object3D translateOnAxis]([page:Vector3 axis], [page:Float distance])</h3>
C
cjshannon 已提交
257
		<div>
G
Greg Tatum 已提交
258 259
		axis -- A normalized vector in object space.<br />
		distance -- The distance to translate.
C
cjshannon 已提交
260 261
		</div>
		<div>
G
Greg Tatum 已提交
262
		Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
C
cjshannon 已提交
263
		</div>
264

265
		<h3>[method:Object3D rotateOnAxis]([page:Vector3 axis], [page:Float angle])</h3>
C
cjshannon 已提交
266
		<div>
G
Greg Tatum 已提交
267 268
		axis -- A normalized vector in object space. <br />
		angle -- The angle in radians.
C
cjshannon 已提交
269 270
		</div>
		<div>
G
Greg Tatum 已提交
271
		Rotate an object along an axis in object space. The axis is assumed to be normalized.
C
cjshannon 已提交
272 273
		</div>

274 275 276 277 278
		<h2>Source</h2>

		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
	</body>
</html>