Skip to main content

Class: Object3D

三维物体,是大部分对象的基类,提供了一系列的属性和方法来对三维空间中的物体进行操作

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Object3D(): Object3D

Returns

Object3D

Defined in

src/objects/Object3D.ts:71

Properties

visible

visible: boolean

是否可见

Defined in

src/objects/Object3D.ts:14


localMatrix

localMatrix: ProjectionMatrix

局部变换矩阵

Defined in

src/objects/Object3D.ts:19


worldMatrix

worldMatrix: ProjectionMatrix

物体的世界变换矩阵 (如果没有父级,那么他和局部变化矩阵相同)

Defined in

src/objects/Object3D.ts:24


matrixAutoUpdate

matrixAutoUpdate: boolean

当这个属性设置了之后,它将计算每一帧的位移、旋转(四元变换)和缩放矩阵,并重新计算 worldMatrix 属性

Defined in

src/objects/Object3D.ts:29


position

position: Vector3

物体局部位置

Defined in

src/objects/Object3D.ts:34


scale

scale: Vector3

物体的局部缩放

Defined in

src/objects/Object3D.ts:39


rotation

rotation: Euler

物体的局部旋转

Defined in

src/objects/Object3D.ts:44


quaternion

quaternion: Quaternion

物体的局部旋转

Defined in

src/objects/Object3D.ts:49


up

up: Vector3

物体的朝向

Defined in

src/objects/Object3D.ts:54


children

children: Object3D[]

对象子级

Defined in

src/objects/Object3D.ts:59


parent

parent: WithNull<Object3D>

对象父级

Defined in

src/objects/Object3D.ts:64


worldMatrixNeedsUpdate

worldMatrixNeedsUpdate: boolean

当这个属性设置了之后,它将计算在那一帧中的 worldMatrix,并将这个值重置为false。默认值为false

Defined in

src/objects/Object3D.ts:69

Methods

add

add(object, notifyChild?): void

添加对象到这个对象的子级

Parameters

NameTypeDefault value
objectObject3Dundefined
notifyChildbooleantrue

Returns

void

Defined in

src/objects/Object3D.ts:97


remove

remove(object, notifyChild?): void

从此对象移除传入的对象(如果存在)

Parameters

NameTypeDefault value
objectObject3Dundefined
notifyChildbooleantrue

Returns

void

Defined in

src/objects/Object3D.ts:111


contains

contains(object): boolean

判断此渲染对象的子集是否包含传入的渲染对象

Parameters

NameType
objectObject3D

Returns

boolean

Defined in

src/objects/Object3D.ts:124


setParent

setParent(object, notifyParent?): void

设置此渲染对象的父集

Parameters

NameTypeDefault valueDescription
objectanyundefined渲染对象
notifyParentbooleantrue设置是否将此渲染对象添加到传入的渲染对象中

Returns

void

Defined in

src/objects/Object3D.ts:133


traverse

traverse(callback): void

遍历此对象(包含子对象)

Parameters

NameTypeDescription
callbackany回调函数

Returns

void

Defined in

src/objects/Object3D.ts:147


lookAt

lookAt(eye, invert?): void

旋转物体使其在世界空间中面朝一个点

Parameters

NameTypeDescription
eyeVector3朝向位置
invert?boolean是否反转

Returns

void

Defined in

src/objects/Object3D.ts:160


updateMatrixWorld

updateMatrixWorld(force?): void

更新渲染对象的世界矩阵

Parameters

NameTypeDescription
force?boolean是否更新次渲染对象的子集

Returns

void

Defined in

src/objects/Object3D.ts:174


updateMatrix

updateMatrix(): void

更新局部变换矩阵

Returns

void

Defined in

src/objects/Object3D.ts:200


decompose

decompose(): void

从局部矩阵计算位置,旋转和缩放

Returns

void

Defined in

src/objects/Object3D.ts:208


clone

clone(): Object3D

克隆此渲染对象

Returns

Object3D

Defined in

src/objects/Object3D.ts:218


copy

copy(object, recursive?): Object3D

复制给定的对象到这个对象中

Parameters

NameTypeDescription
objectObject3D渲染对象
recursive?boolean设置是否复制子对象

Returns

Object3D

Defined in

src/objects/Object3D.ts:227