这是Three.js中大部分对象的基类,提供了一系列的属性和方法来对三维空间中的物体进行操纵。
This is the base class for most objects in three.js and provides a set of properties and methods
for manipulating objects in 3D space.
请注意,它可以通过[page:.add]( object )方法来将对象进行组合,该方法将对象添加为子对象,但为此最好使用[page:Group](来作为父对象)。
构造器中不带有参数。
对象是否被渲染到阴影贴图中。默认值为*false*。
含有对象的子级的数组。请参阅[page:Group]来了解将手动对象进行分组的相关信息。
当这个属性被设置的时候,它将在渲染物体之前,检查每一帧的物体是否在摄像机的视锥体中。 否则,即使该物体不可见,它也将在每一帧中被渲染,默认值为*true*。
只读 —— 表示对象实例ID的唯一数字
Used to check whether this or derived classes are Object3Ds. Default is *true*.
You should not change this, as it is used internally for optimisation.
The layer membership of the object. The object is only visible if it has at least one layer in common with the [page:Camera] in use.
The local transform matrix.
When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DefaultMatrixAutoUpdate] (true).
The global transform of the object. If the Object3D has no parent, then it's identical to the local transform [page:.matrix].
When this is set, it calculates the matrixWorld in that frame and resets this property to false. Default is *false*.
This is passed to the shader and used to calculate the position of the object.
Optional name of the object (doesn't need to be unique). Default is an empty string.
This is passed to the shader and used to calculate lighting for the object. It is the transpose of the inverse of the upper left 3x3 sub-matrix of this object's modelViewMatrix.
The reason for this special matrix is that simply using the modelViewMatrix could result in a non-unit length of normals (on scaling) or in a non-perpendicular direction (on non-uniform scaling).
On the other hand the translation part of the modelViewMatrix is not relevant for the calculation of normals. Thus a Matrix3 is sufficient.
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.
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.
Object's parent in the [link:https://en.wikipedia.org/wiki/Scene_graph scene graph]. An object can have at most one parent.
A [page:Vector3] representing the object's local position. Default is (0, 0, 0).
Object's local rotation as a [page:Quaternion Quaternion].
Whether the material receives shadows. Default is *false*.
This value allows the default rendering order of [link:https://en.wikipedia.org/wiki/Scene_graph scene graph] objects to be overridden although opaque and transparent objects remain sorted independently. Sorting is from lowest to highest renderOrder. Default value is *0*.
Object's local rotation (see [link:https://en.wikipedia.org/wiki/Euler_angles Euler angles]), in radians.
The object's local scale. Default is [page:Vector3]( 1, 1, 1 ).
This is used by the [page:.lookAt lookAt] method, for example, to determine the orientation of the result.
Default is [page:Object3D.DefaultUp] - that is, ( 0, 1, 0 ).
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.
[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. This gets automatically assigned, so this shouldn't be edited.
Object gets rendered if *true*. Default is *true*.
Static properties and methods are defined per class rather than per instance of that class. This means that changing [page:Object3D.DefaultUp] or [page:Object3D.DefaultMatrixAutoUpdate] will change the values of [page:.up up] and [page:.matrixAutoUpdate matrixAutoUpdate] for every instance of Object3D (or derived classes) created after the change has been made (already created Object3Ds will not be affected).
The default [page:.up up] direction for objects, also used as the default position for [page:DirectionalLight],
[page:HemisphereLight] and [page:Spotlight] (which creates lights shining from the top down).
Set to ( 0, 1, 0 ) by default.
The default setting for [page:.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.
Adds *object* as child of this object. An arbitrary number of objects may be added. Any current parent on an
object passed in here will be removed, since an object can have at most one parent.
See [page:Group] for info on manually grouping objects.
Applies the matrix transform to the object and updates the object's position, rotation and scale.
Applies the rotation represented by the quaternion to the object.
recursive -- if true, descendants of the object are also cloned. Default is true.
Returns a clone of this object and optionally all descendants.
recursive -- if true, descendants of the object are also copied. Default is true.
Copy the given object into this object.
id -- Unique number of the object instance
Searches through the object's children and returns the first with a matching id.
Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
name -- String to match to the children's Object3D.name property.
Searches through the object's children and returns the first with a matching name.
Note that for most objects the name is an empty string by default. You will
have to set it manually to make use of this method.
name -- the property name to search for.
value -- value of the given property.
Searches through the object's children and returns the first with a property that matches the value given.
[page:Vector3 target] — the result will be copied into this Vector3.
Returns a vector representing the position of the object in world space.
[page:Quaternion target] — the result will be copied into this Quaternion.
Returns a quaternion representing the rotation of the object in world space.
[page:Vector3 target] — the result will be copied into this Vector3.
Returns a vector of the scaling factors applied to the object for each axis in world space.
[page:Vector3 target] — the result will be copied into this Vector3.
Returns a vector representing the direction of object's positive z-axis in world space.
vector - A vector representing a position in local (object) space.
Converts the vector from local space to world space.
vector - A vector representing a position in world space.
Optionally, the [page:.x x], [page:.y y] and [page:.z z] components of the world space position.
Rotates the object to face a point in world space.
This method does not support objects with rotated and/or translated parent(s).
Abstract (empty) 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 use raycasting.
Removes *object* as child of this object. An arbitrary number of objects may be removed.
axis -- A normalized vector in object space.
angle -- The angle in radians.
Rotate an object along an axis in object space. The axis is assumed to be normalized.
axis -- A normalized vector in world space.
angle -- The angle in radians.
Rotate an object along an axis in world space. The axis is assumed to be normalized.
Method Assumes no rotated parent.
rad - the angle to rotate in radians.
Rotates the object around x axis in local space.
rad - the angle to rotate in radians.
Rotates the object around y axis in local space.
rad - the angle to rotate in radians.
Rotates the object around z axis in local space.
axis -- A normalized vector in object space.
angle -- angle in radians
Calls [page:Quaternion.setFromAxisAngle setFromAxisAngle]( [page:Float axis], [page:Float angle] )
on the [page:.quaternion].
euler -- Euler angle specifying rotation amount.
Calls [page:Quaternion.setRotationFromEuler setRotationFromEuler]( [page:Euler euler])
on the [page:.quaternion].
m -- rotate the quaternion by the rotation component of the matrix.
Calls [page:Quaternion.setFromRotationMatrix setFromRotationMatrix]( [page:Matrix4 m])
on the [page:.quaternion].
Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
q -- normalized Quaternion.
Copy the given quaternion into [page:.quaternion].
Convert the object to JSON format.
axis -- A normalized vector in object space.
distance -- The distance to translate.
Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
Translates object along x axis in object space by *distance* units.
Translates object along y axis in object space by *distance* units.
Translates object along z axis in object space by *distance* units.
callback - A function with as first argument an object3D object.
Executes the callback on this object and all descendants.
callback - A function with as first argument an object3D object.
Like traverse, but the callback will only be executed for visible objects.
Descendants of invisible objects are not traversed.
callback - A function with as first argument an object3D object.
Executes the callback on all ancestors.
Update the local transform.
Update the global transform of the object and its children.
vector - A world vector.
Updates the vector from world space to local space.