Skip to content

Class: Transform

The Transform component contains the position, rotation, and scaling of an object in 3D space. Each object (Object 3D) has a Transform component

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Transform(): Transform

Returns

Transform

Overrides

ComponentBase.constructor

Defined in

src/components/Transform.ts:208

Properties

object3D

object3D: Object3D = null

owner object3D

Inherited from

ComponentBase.object3D

Defined in

src/components/ComponentBase.ts:17


isDestroyed

Optional isDestroyed: boolean

Inherited from

ComponentBase.isDestroyed

Defined in

src/components/ComponentBase.ts:38


_localRot

_localRot: Vector3

Defined in

src/components/Transform.ts:99


index

index: number

Defined in

src/components/Transform.ts:109


index2

index2: number

Defined in

src/components/Transform.ts:110


_worldMatrix

Readonly _worldMatrix: Matrix4

Defined in

src/components/Transform.ts:121


static

static: boolean = false

Defined in

src/components/Transform.ts:124


depthOrder

depthOrder: number = 0

Defined in

src/components/Transform.ts:125

Accessors

eventDispatcher

get eventDispatcher(): CEventDispatcher

Returns

CEventDispatcher

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:23

set eventDispatcher(value): void

Parameters

NameType
valueCEventDispatcher

Returns

void

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:28


isStart

get isStart(): boolean

Returns

boolean

Inherited from

ComponentBase.isStart

Defined in

src/components/ComponentBase.ts:40


transform

get transform(): Transform

Return the Transform component attached to the Object3D.

Returns

Transform

Inherited from

ComponentBase.transform

Defined in

src/components/ComponentBase.ts:47


localChange

get localChange(): boolean

Returns

boolean

Defined in

src/components/Transform.ts:127

set localChange(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

src/components/Transform.ts:131


targetPos

get targetPos(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:136

set targetPos(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:139


parent

get parent(): Transform

Returns

Transform

Defined in

src/components/Transform.ts:143

set parent(value): void

Parameters

NameType
valueTransform

Returns

void

Defined in

src/components/Transform.ts:147


enable

get enable(): boolean

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Returns

boolean

Overrides

ComponentBase.enable

Defined in

src/components/Transform.ts:189

set enable(value): void

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Parameters

NameType
valueboolean

Returns

void

Overrides

ComponentBase.enable

Defined in

src/components/Transform.ts:179


scene3D

get scene3D(): Scene3D

Returns

Scene3D

Defined in

src/components/Transform.ts:193

set scene3D(value): void

Parameters

NameType
valueScene3D

Returns

void

Defined in

src/components/Transform.ts:197


view3D

get view3D(): View3D

Returns

View3D

Defined in

src/components/Transform.ts:201


up

get up(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:246

set up(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:251


down

get down(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:258

set down(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:263


forward

get forward(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:277

set forward(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:282


back

get back(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:296

set back(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:301


left

get left(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:308

set left(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:313


get right(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:320

set right(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:325


localRotQuat

get localRotQuat(): Quaternion

The transformation property of the object relative to the parent, stored in the from of a quaternion

Returns

Quaternion

Defined in

src/components/Transform.ts:343

set localRotQuat(value): void

Parameters

NameType
valueQuaternion

Returns

void

Defined in

src/components/Transform.ts:350


x

get x(): number

The position of the object relative to its parent X-axis

Returns

number

Defined in

src/components/Transform.ts:493

set x(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:477


y

get y(): number

The position of the object relative to its parent Y-axis

Returns

number

Defined in

src/components/Transform.ts:513

set y(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:497


z

get z(): number

The position of the object relative to its parent Y-axis

Returns

number

Defined in

src/components/Transform.ts:533

set z(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:517


scaleX

get scaleX(): number

The scale of the object relative to its parent X-axis

Returns

number

Defined in

src/components/Transform.ts:553

set scaleX(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:537


scaleY

get scaleY(): number

The scale of the object relative to its parent Y-axis

Returns

number

Defined in

src/components/Transform.ts:573

set scaleY(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:557


scaleZ

get scaleZ(): number

The scale of the object relative to its parent Z-axis

Returns

number

Defined in

src/components/Transform.ts:594

set scaleZ(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:577


rotationX

get rotationX(): number

The rotation of the object relative to its parent X-axis

Returns

number

Defined in

src/components/Transform.ts:614

set rotationX(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:598


rotationY

get rotationY(): number

The rotation of the object relative to its parent Y-axis

Returns

number

Defined in

src/components/Transform.ts:634

set rotationY(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:618


rotationZ

get rotationZ(): number

The rotation of the object relative to its parent Z-axis

Returns

number

Defined in

src/components/Transform.ts:654

set rotationZ(value): void

Parameters

NameType
valuenumber

Returns

void

Defined in

src/components/Transform.ts:638


worldPosition

get worldPosition(): Vector3

world position

Returns

Vector3

Defined in

src/components/Transform.ts:661


localPosition

get localPosition(): Vector3

The position of an object relative to its parent

Returns

Vector3

Defined in

src/components/Transform.ts:689

set localPosition(v): void

Parameters

NameType
vVector3

Returns

void

Defined in

src/components/Transform.ts:668


localRotation

get localRotation(): Vector3

The rotaion vector of an object relative to its parent

Returns

Vector3

Defined in

src/components/Transform.ts:714

set localRotation(v): void

Parameters

NameType
vVector3

Returns

void

Defined in

src/components/Transform.ts:693


localScale

get localScale(): Vector3

The scale of an object relative to its parent

Returns

Vector3

Defined in

src/components/Transform.ts:735

set localScale(v): void

Parameters

NameType
vVector3

Returns

void

Defined in

src/components/Transform.ts:718


localDetailScale

get localDetailScale(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:740

set localDetailScale(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:744


localDetailRot

get localDetailRot(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:749

set localDetailRot(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:753


localDetailPos

get localDetailPos(): Vector3

Returns

Vector3

Defined in

src/components/Transform.ts:758

set localDetailPos(value): void

Parameters

NameType
valueVector3

Returns

void

Defined in

src/components/Transform.ts:761

Methods

init

init(param?): void

Parameters

NameType
param?any

Returns

void

Inherited from

ComponentBase.init

Defined in

src/components/ComponentBase.ts:112


onEnable

onEnable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onEnable

Defined in

src/components/ComponentBase.ts:115


onDisable

onDisable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onDisable

Defined in

src/components/ComponentBase.ts:116


onUpdate

onUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onUpdate

Defined in

src/components/ComponentBase.ts:117


onLateUpdate

onLateUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onLateUpdate

Defined in

src/components/ComponentBase.ts:118


onBeforeUpdate

onBeforeUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onBeforeUpdate

Defined in

src/components/ComponentBase.ts:119


onCompute

onCompute(view?, command?): any

Parameters

NameType
view?View3D
command?GPUCommandEncoder

Returns

any

Inherited from

ComponentBase.onCompute

Defined in

src/components/ComponentBase.ts:120


onGraphic

onGraphic(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onGraphic

Defined in

src/components/ComponentBase.ts:121


onParentChange

onParentChange(lastParent?, currentParent?): any

Parameters

NameType
lastParent?Object3D
currentParent?Object3D

Returns

any

Inherited from

ComponentBase.onParentChange

Defined in

src/components/ComponentBase.ts:122


onAddChild

onAddChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onAddChild

Defined in

src/components/ComponentBase.ts:123


onRemoveChild

onRemoveChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onRemoveChild

Defined in

src/components/ComponentBase.ts:124


copyComponent

copyComponent(from): this

Parameters

NameType
fromthis

Returns

this

Inherited from

ComponentBase.copyComponent

Defined in

src/components/ComponentBase.ts:133


awake

awake(): void

Returns

void

Defined in

src/components/Transform.ts:223


start

start(): void

Returns

void

Overrides

ComponentBase.start

Defined in

src/components/Transform.ts:225


stop

stop(): void

Returns

void

Overrides

ComponentBase.stop

Defined in

src/components/Transform.ts:227


updateWorldMatrix

updateWorldMatrix(force?): void

Update the matrix4 in world space

Parameters

NameTypeDefault value
forcebooleanfalse

Returns

void

Defined in

src/components/Transform.ts:400


updateChildTransform

updateChildTransform(): void

Returns

void

Defined in

src/components/Transform.ts:412


lookTarget

lookTarget(target, up?): void

Parameters

NameTypeDefault value
targetVector3undefined
upVector3Vector3.UP

Returns

void

Defined in

src/components/Transform.ts:428


lookAt

lookAt(pos, target, up?): void

Current object's gaze position (global) (modified by its own global transformation)

Parameters

NameTypeDefault valueDescription
posVector3undefinedOwn position (global)
targetVector3undefinedLocation of the target (global)
upVector3Vector3.UPup direction

Returns

void

Defined in

src/components/Transform.ts:438


decomposeFromMatrix

decomposeFromMatrix(matrix, orientationStyle?): this

Parameters

NameTypeDefault value
matrixMatrix4undefined
orientationStylestring'eulerAngles'

Returns

this

Defined in

src/components/Transform.ts:454


cloneTo

cloneTo(obj): void

Create a new component, copy the properties of the current component, and add it to the target object.

Parameters

NameTypeDescription
objObject3Dsource Object3D

Returns

void

Overrides

ComponentBase.cloneTo

Defined in

src/components/Transform.ts:471


beforeDestroy

beforeDestroy(force?): void

before release this component, object refrences are not be set null now.

Parameters

NameType
force?boolean

Returns

void

Overrides

ComponentBase.beforeDestroy

Defined in

src/components/Transform.ts:767


destroy

destroy(): void

release this component

Returns

void

Overrides

ComponentBase.destroy

Defined in

src/components/Transform.ts:774