Object3D.html 6.6 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 26 27 28 29 30 31 32


		<h2>Properties</h2>

		<h3>.[page:Integer id]</h3>
		<div>
		Unique number of this object instance.
		</div>

		<h3>.[page:String name]</h3>
		<div>
S
sole 已提交
33
		Optional name of the object (doesn't need to be unique).
34
		</div>
M
Mr.doob 已提交
35

36 37
		<h3>.[page:Object3D parent]</h3>
		<div>
S
sole 已提交
38
		Object's parent in the scene graph.
39
		</div>
M
Mr.doob 已提交
40

41 42 43 44 45 46 47 48 49 50
		<h3>.[page:Object3D children]</h3>
		<div>
		Array with object's children.
		</div>

		<h3>.[page:Vector3 position]</h3>
		<div>
		Object's local position.
		</div>

51
		<h3>.[page:Euler rotation]</h3>
52
		<div>
G
Greg Tatum 已提交
53
		Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles" target="_blank">Euler angles</a>), in radians.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
		</div>

		<h3>.[page:String eulerOrder]</h3>
		<div>
		Order of axis for Euler angles.
		</div>

		<h3>.[page:Vector3 scale]</h3>
		<div>
		Object's local scale.
		</div>

		<h3>.[page:Vector3 up]</h3>
		<div>
		Up direction.
		</div>

S
sole 已提交
71
		<h3>.[page:Matrix4 matrix]</h3>
72 73 74 75 76 77
		<div>
		Local transform.
		</div>

		<h3>.[page:Quaternion quaternion]</h3>
		<div>
78
		Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
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
		</div>

		<h3>.[page:Boolean useQuaternion]</h3>
		<div>
		Use quaternion instead of Euler angles for specifying local rotation.
		</div>

		<h3>.[page:Float renderDepth]</h3>
		<div>
		Override depth-sorting order if non *null*.
		</div>

		<h3>.[page:Boolean visible]</h3>
		<div>
		Object gets rendered if *true*.
		</div>

		<h3>.[page:Boolean castShadow]</h3>
		<div>
		Gets rendered into shadow map.
		</div>

		<h3>.[page:Boolean receiveShadow]</h3>
		<div>
		Material gets baked in shadow receiving.
		</div>

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

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

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

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

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

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

G
Greg Tatum 已提交
136
		
137
		<h2>Methods</h2>
138
		
G
Greg Tatum 已提交
139 140
		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
		
141 142 143 144 145 146 147 148
		<h3>.applyMatrix( [page:Matrix4 matrix])</h3>
		<div>
		matrix - matrix
		</div>
		<div>
		This updates the position, rotation and scale with the matrix.
		</div>
		
149 150
		<h3>.translateX( [page:Float distance] )</h3>
		<div>
151 152 153
		distance - Distance.<br />
		</div>
		<div>
154 155 156 157 158
		Translates object along x axis by distance.
		</div>

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

		<h3>.translateZ( [page:Float distance] )</h3>
		<div>
167 168 169
		distance - Distance.<br />
		</div>
		<div>
170 171
		Translates object along z axis by distance.
		</div>
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
		
		<h3>.localToWorld( [page:Vector3 vector] )</h3>
		<div>
		vector - A local vector.<br />
		</div>
		<div>
		Updates the vector from local space to world space.
		</div>

		<h3>.worldToLocal( [page:Vector3 vector] )</h3>
		<div>
		vector - A world vector.<br />
		</div>
		<div>
		Updates the vector from world space to local space.
		</div>
188 189 190

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

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

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

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

221 222 223 224 225 226 227 228 229 230
		<h3>.updateMatrix()</h3>
		<div>
		Updates local transform.
		</div>

		<h3>.updateMatrixWorld( [page:Boolean force] )</h3>
		<div>
		Updates global transform of the object and its children.
		</div>

231 232 233 234 235
		<h3>.clone()</h3>
		<div>
		Creates a new clone of this object and all descendants.
		</div>

236

G
Greg Tatum 已提交
237
		<h3>.getObjectByName([page:String name], [page:Boolean recursive]) [page:Object3d Object3d]</h3>
C
cjshannon 已提交
238
		<div>
G
Greg Tatum 已提交
239 240
		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 已提交
241 242
		</div>
		<div>
G
Greg Tatum 已提交
243
		Searches through the object's children and returns the first with a matching name, optionally recursive.
C
cjshannon 已提交
244 245
		</div>

G
Greg Tatum 已提交
246
		<h3>.getObjectById([page:Integer id], [page:Boolean recursive]) [page:Object3D]</h3>
C
cjshannon 已提交
247
		<div>
G
Greg Tatum 已提交
248 249
		id -- Unique number of the object instance<br />
		recursive -- Boolean whether to search through the children's children. Default is false.
C
cjshannon 已提交
250 251
		</div>
		<div>
G
Greg Tatum 已提交
252
		Searches through the object's children and returns the first with a matching id, optionally recursive.
C
cjshannon 已提交
253
		</div>
G
Greg Tatum 已提交
254 255
		
		<h3>.translateOnAxis([page:Vector3 axis], [page:Float distance]) [page:Object3D]</h3>
C
cjshannon 已提交
256
		<div>
G
Greg Tatum 已提交
257 258
		axis -- A normalized vector in object space.<br />
		distance -- The distance to translate.
C
cjshannon 已提交
259 260
		</div>
		<div>
G
Greg Tatum 已提交
261
		Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
C
cjshannon 已提交
262
		</div>
G
Greg Tatum 已提交
263 264
		
		<h3>.rotateOnAxis([page:Vector3 axis], [page:Float angle]) [page:Object3D]</h3>
C
cjshannon 已提交
265
		<div>
G
Greg Tatum 已提交
266 267
		axis -- A normalized vector in object space. <br />
		angle -- The angle in radians.
C
cjshannon 已提交
268 269
		</div>
		<div>
G
Greg Tatum 已提交
270
		Rotate an object along an axis in object space. The axis is assumed to be normalized.
C
cjshannon 已提交
271 272
		</div>

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

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