Object3D class
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 add method which adds the object as a child, however it is better to use Group for this.
Constructors
Properties
- autoUpdate ↔ bool
-
getter/setter pair
- background ↔ dynamic
-
getter/setter pair
- bindMatrix ↔ Matrix4?
-
getter/setter pair
- castShadow ↔ bool
-
getter/setter pair
-
children
↔ List<
Object3D> -
getter/setter pair
- count ↔ int?
-
getter/setter pair
- customDepthMaterial ↔ Material?
-
- Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes.
- When shadow-casting with a DirectionalLight or SpotLight, if you are (a) modifying vertex positions in
- the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a
- transparent texture with alphaTest, you must specify a customDepthMaterial for proper shadows.
getter/setter pair - customDistanceMaterial ↔ Material?
-
getter/setter pair
- disposed ↔ bool
-
getter/setter pair
- environment ↔ Texture?
-
getter/setter pair
-
extra
↔ Map<
String, dynamic> -
getter/setter pair
- frustumCulled ↔ bool
-
getter/setter pair
- geometry ↔ BufferGeometry?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ int
-
getter/setter pair
-
instanceColor
↔ BufferAttribute<
NativeArray< ?num> > -
getter/setter pair
- instanceMatrix ↔ InstancedBufferAttribute?
-
getter/setter pair
- isImmediateRenderObject ↔ bool
-
getter/setter pair
- layers ↔ Layers
-
getter/setter pair
- material ↔ Material?
-
getter/setter pair
- matrix ↔ Matrix4
-
getter/setter pair
- matrixAutoUpdate ↔ bool
-
getter/setter pair
- matrixWorld ↔ Matrix4
-
getter/setter pair
- matrixWorldNeedsUpdate ↔ bool
-
getter/setter pair
- modelViewMatrix ↔ Matrix4
-
getter/setter pair
-
morphTargetDictionary
↔ Map<
String, dynamic> ? -
getter/setter pair
-
morphTargetInfluences
↔ List<
double> -
getter/setter pair
- name ↔ String
-
getter/setter pair
- normalMatrix ↔ Matrix3
-
getter/setter pair
- onAfterRender ↔ OnAfterRender?
-
An optional callback that is executed immediately after a 3D object is
rendered. This function is called with the following parameters: renderer,
scene, camera, geometry, material, group.
getter/setter pair
- onBeforeRender ↔ OnBeforeRender?
-
getter/setter pair
- overrideMaterial ↔ Material?
-
getter/setter pair
- parent ↔ Object3D?
-
getter/setter pair
- position ↔ Vector3
-
getter/setter pair
- quaternion ↔ Quaternion
-
getter/setter pair
- receiveShadow ↔ bool
-
getter/setter pair
- renderOrder ↔ int
-
getter/setter pair
- rotation ↔ Euler
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale ↔ Vector3
-
getter/setter pair
- skeleton ↔ Skeleton?
-
getter/setter pair
- tag ↔ String?
-
getter/setter pair
- type ↔ String
-
getter/setter pair
- up ↔ Vector3
-
getter/setter pair
-
userData
↔ Map<
String, dynamic> -
getter/setter pair
- uuid ↔ String
-
getter/setter pair
- visible ↔ bool
-
getter/setter pair
Methods
-
add(
Object3D? object) → Object3D -
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. -
addAll(
List< Object3D> objects) → Object3D -
Adds list
objects
as child of this object. -
addEventListener(
String type, Function listener) → void -
type
- The type of event to listen to.inherited -
applyMatrix4(
Matrix4 matrix) → void - Applies the matrix transform to the object and updates the object's position, rotation and scale.
-
applyQuaternion(
Quaternion q) → Object3D - Applies the rotation represented by the quaternion to the object.
-
attach(
Object3D object) → Object3D -
clear(
) → Object3D - Removes all child objects.
-
clearListeners(
) → void -
Remove all Listeners.
inherited
-
clone(
[bool? recursive]) → Object3D -
recursive
-- if true, descendants of the object are also cloned. Default is true. -
copy(
Object3D source, [bool? recursive = true]) → Object3D -
recursive
-- If set totrue
, descendants of the object are copied next to the existing ones. If set tofalse
, descendants are left unchanged. Default istrue
. -
dispatchEvent(
Event event) → void -
event
- The event that gets fired.inherited -
dispose(
) → void -
extractFromCache(
Map< String, dynamic> cache) → List<Map< String, dynamic> > -
getObjectById(
String id) → Object3D? - id -- Unique number of the object instance
-
getObjectByName(
String name) → Object3D? -
name
-- String to match to the children's Object3D.name property. -
getObjectByProperty(
String name, String value) → Object3D? -
name
-- the property name to search for. -
getProperty(
String propertyName) → dynamic -
getValue(
String name) → Matrix4? -
getWorldDirection(
Vector3 target) → Vector3 -
target
— the result will be copied into this Vector3. -
getWorldPosition(
Vector3? target) → Vector3 -
target
— the result will be copied into this Vector3. -
getWorldQuaternion(
Quaternion target) → Quaternion -
target
— the result will be copied into this Quaternion. -
getWorldScale(
Vector3 target) → Vector3 -
target
— the result will be copied into this Vector3. -
hasEventListener(
String type, Function listener) → bool -
type
- The type of event to listen to.inherited -
init(
) → void -
localToWorld(
Vector3 vector) → Vector3 -
vector
- A vector representing a position in this object's local space. -
lookAt(
Vector3 position) → void -
vector
- A vector representing a position in world space. Optionally, thex
,y
andz
components of the world space position. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onQuaternionChange(
) → void -
onRotationChange(
) → void -
raycast(
Raycaster raycaster, List< Intersection> intersects) → void - Abstract (empty) method to get intersections between a casted ray and this object. Subclasses such as Mesh, Line, and Points implement this method in order to use raycasting.
-
remove(
Object3D object) → Object3D -
Removes
object
as child of this object. An arbitrary number of objects may be removed. -
removeEventListener(
String type, Function listener) → void -
type - The type of the listener that gets removed.
inherited
-
removeFromParent(
) → Object3D - Removes this object from its current parent.
-
removeList(
List< Object3D> objects) → Object3D -
Removes list of
objects
from this object. -
rotateOnAxis(
Vector3 axis, double angle) → Object3D -
axis
-- A normalized vector in object space. -
rotateOnWorldAxis(
Vector3 axis, double angle) → Object3D -
axis
-- A normalized vector in world space. -
rotateX(
double angle) → Object3D -
angle
- the angle to rotate in radians. -
rotateY(
double angle) → Object3D -
angle
- the angle to rotate in radians. -
rotateZ(
double angle) → Object3D -
angle
- the angle to rotate in radians. -
serialize(
Map< String, dynamic> library, dynamic element, Object3dMeta? meta) → String -
setProperty(
String propertyName, dynamic value) → Object3D -
setRotationFromAxisAngle(
Vector3 axis, double angle) → void -
axis
- A normalized vector in object space. -
setRotationFromEuler(
Euler euler) → void - euler -- Euler angle specifying rotation amount.
-
setRotationFromMatrix(
dynamic m) → void -
m
- rotate the quaternion by the rotation component of the matrix. -
setRotationFromQuaternion(
Quaternion q) → void -
q
- normalized Quaternion. -
toJson(
{Object3dMeta? meta}) → Map< String, dynamic> - meta -- object containing metadata such as materials, textures or images for the object.
-
toString(
) → String -
A string representation of this object.
inherited
-
translateOnAxis(
Vector3 axis, double distance) → Object3D -
axis
- A normalized vector in object space. -
translateX(
double distance) → Object3D -
Translates object along x axis in object space by
distance
units. -
translateY(
double distance) → Object3D -
Translates object along y axis in object space by
distance
units. -
translateZ(
double distance) → Object3D -
Translates object along z axis in object space by
distance
units. -
traverse(
dynamic callback(Object3D)) → void -
callback
- A function with as first argument an object3D object. -
traverseAncestors(
dynamic callback(Object3D?)) → void -
callback
- A function with as first argument an object3D object. -
traverseVisible(
dynamic callback(Object3D?)) → void -
callback
- A function with as first argument an object3D object. -
updateMatrix(
) → void - Updates the local transform.
-
updateMatrixWorld(
[bool force = false]) → void -
force
- A boolean that can be used to bypassmatrixWorldAutoUpdate
, to recalculate the world matrix of the object and descendants on the current frame. Useful if you cannot wait for the renderer to update it on the next frame (assumingmatrixWorldAutoUpdate
set totrue
). -
updateWorldMatrix(
bool updateParents, bool updateChildren) → void -
updateParents
- recursively updates global transform of ancestors. -
worldToLocal(
Vector3 vector) → Vector3 -
vector
- A vector representing a position in world space.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultMatrixAutoUpdate ↔ bool
-
getter/setter pair
- defaultUp ↔ Vector3
-
getter/setter pair