[name]
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.
Note that this can be used for grouping objects via the [page:.add]( object ) method
which adds the object as a child, however it is better to use [page:Group] for this.
Constructor
[name]()
The constructor takes no arguments.
Properties
[property:Boolean castShadow]
Whether the object gets rendered into shadow map. Default is *false*.
[property:Object3D children]
Array with object's children. See [page:Group] for info on manually grouping objects.
[property:Boolean frustumCulled]
When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
Otherwise the object gets renderered every frame even if it isn't visible. Default is *true*.
[property:Integer id]
readonly – Unique number for this object instance.
[property:Boolean isObject]
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.
[property:Layers layers]
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.
[property:Matrix4 matrix]
The local transform matrix.
[property:Boolean matrixAutoUpdate]
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).
[property:Matrix4 matrixWorld]
The global transform of the object. If the Object3D has no parent, then it's identical to
the local transform [page:.matrix].
[property:Boolean matrixWorldNeedsUpdate]
When this is set, it calculates the matrixWorld in that frame and resets this property
to false. Default is *false*.
[property:Matrix4 modelViewMatrix]
This is passed to the shader and used to calculate the position of the object.
[property:String name]
Optional name of the object (doesn't need to be unique). Default is an empty string.
[property:Matrix3 normalMatrix]
This is passed to the shader and used to calculate lighting for the object.
[property:function onAfterRender]
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.
[property:function onBeforeRender]
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.
[property:Object3D parent]
Object's parent in the [link:https://en.wikipedia.org/wiki/Scene_graph scene graph].
[property:Vector3 position]
The object's local position.
[property:Quaternion quaternion]
Object's local rotation as a [page:Quaternion Quaternion].
[property:Boolean receiveShadow]
Whether the material receives shadows. Default is *false*.
[property:Number renderOrder]
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*.
[property:Euler rotation]
Object's local rotation (see [link:https://en.wikipedia.org/wiki/Euler_angles Euler angles]), in radians.
[property:Vector3 scale]
The object's local [property:Vector3 scale]. Default is [page:Vector3]( 1, 1, 1 ).
[property:Vector3 up]
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 ).
[property:object userData]
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.
[property:String uuid]
[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
This gets automatically assigned, so this shouldn't be edited.
[property:Boolean visible]
Object gets rendered if *true*. Default is *true*.
Static Properties
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).
[property:Vector3 DefaultUp]
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.
[property:Vector3 DefaultMatrixAutoUpdate]
The default setting for [page:.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.
Methods
[page:EventDispatcher EventDispatcher] methods are available on this class.
[method:null add]( [page:Object3D object], ... )
Adds *object* as child of this object. An arbitrary number of objects may be added.
See [page:Group] for info on manually grouping objects.
[method:null applyMatrix]( [page:Matrix4 matrix] )
This updates the position, rotation and scale with the matrix.
[method:Object3D clone]( [page:Boolean recursive] )
recursive -- if true, descendants of the object are also cloned. Default is true.
Returns a clone of this object and optionally all descendants.
[method:Object3D copy]( [page:Object3D object], [page:Boolean recursive] )
recursive -- if true, descendants of the object are also copied. Default is true.
Copy the given object into this object.
[method:Object3D getObjectById]( [page:Integer id] )
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.
[method:Object3D getObjectByName]( [page:String name] )
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 [property:name] is an empty string by default. You will
have to set it manually to make use of this method.
[method:Object3D getObjectByProperty]( [page:String name], [page:Float value] )
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.
[method:Vector3 getWorldPosition]( [page:Vector3 optionalTarget] )
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Vector3] is instantiated.
Returns a vector representing the position of the object in world space.
[method:Quaternion getWorldQuaternion]( [page:Quaternion optionalTarget] )
optionalTarget — (optional) if specified, the result will be copied into this Quaternion,
otherwise a new Quaternion will be created.
Returns a quaternion representing the rotation of the object in world space.
[method:Euler getWorldRotation]( [page:Euler optionalTarget] )
optionalTarget — (optional) if specified, the result will be copied into this Euler,
otherwise a new Euler will be created.
Returns the euler angles representing the rotation of the object in world space.
[method:Vector3 getWorldScale]( [page:Vector3 optionalTarget] )
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created.
Returns a vector of the scaling factors applied to the object for each axis in world space.
[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created.
Returns a vector representing the direction of object's positive z-axis in world space.
[method:Vector3 localToWorld]( [page:Vector3 vector] )
vector - A vector representing a position in local (object) space.
Converts the vector from local space to world space.
[method:null lookAt]( [page:Vector3 vector] )
vector - A vector representing a position in world space.
Rotates the object to face a point in world space.
[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )
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.
[method:null remove]( [page:Object3D object], ... )
Removes *object* as child of this object. An arbitrary number of objects may be removed.
[method:Object3D rotateOnAxis]( [page:Vector3 axis], [page:Float angle] )
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.
[method:null rotateX]( [page:Float rad] )
rad - the angle to rotate in radians.
Rotates the object around x axis in local space.
[method:null rotateY]( [page:Float rad] )
rad - the angle to rotate in radians.
Rotates the object around y axis in local space.
[method:null rotateZ]( [page:Float rad] )
rad - the angle to rotate in radians.
Rotates the object around z axis in local space.
[method:null setRotationFromAxisAngle]( [page:Vector3 axis], [page:Float angle] )
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].
[method:null setRotationFromEuler]( [page:Euler euler] )
euler -- Euler angle specifying rotation amount.
Calls [page:Quaternion.setRotationFromEuler setRotationFromEuler]( [page:Euler euler])
on the [page:.quaternion].
[method:null setRotationFromMatrix]( [page:Matrix4 m] )
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).
[method:null setRotationFromQuaternion]( [page:Quaternion q] )
q -- normalized Quaternion.
Copy the given quaternion into [page:.quaternion].
[method:null toJSON]( [page:Quaternion q] )
Convert the object to JSON format.
[method:Object3D translateOnAxis]( [page:Vector3 axis], [page:Float distance] )
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.
[method:null translateX]( [page:Float distance] )
Translates object along x axis by *distance* units.
[method:null translateY]( [page:Float distance] )
Translates object along y axis by *distance* units.
[method:null translateZ]( [page:Float distance] )
Translates object along z axis by *distance* units.
[method:null traverse]( [page:Function callback] )
callback - A function with as first argument an object3D object.
Executes the callback on this object and all descendants.
[method:null traverseVisible]( [page:Function callback] )
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.
[method:null traverseAncestors]( [page:Function callback] )
callback - A function with as first argument an object3D object.
Executes the callback on all ancestors.
[method:null updateMatrix]()
Update the local transform.
[method:null updateMatrixWorld]( [page:Boolean force] )
Update the global transform of the object and its children.
[method:Vector3 worldToLocal]( [page:Vector3 vector] )
vector - A world vector.
Updates the vector from world space to local space.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]