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
↳
Transform
Constructors
Properties
Accessors
- eventDispatcher
- isStart
- transform
- localChange
- targetPos
- parent
- enable
- scene3D
- view3D
- up
- down
- forward
- back
- left
- right
- localRotQuat
- x
- y
- z
- scaleX
- scaleY
- scaleZ
- rotationX
- rotationY
- rotationZ
- worldPosition
- localPosition
- localRotation
- localScale
- localDetailScale
- localDetailRot
- localDetailPos
Methods
- init
- onEnable
- onDisable
- onUpdate
- onLateUpdate
- onBeforeUpdate
- onCompute
- onGraphic
- onParentChange
- onAddChild
- onRemoveChild
- copyComponent
- awake
- start
- stop
- updateWorldMatrix
- updateChildTransform
- lookTarget
- lookAt
- decomposeFromMatrix
- cloneTo
- beforeDestroy
- destroy
Constructors
constructor
• new Transform(): Transform
Returns
Overrides
Defined in
src/components/Transform.ts:208
Properties
object3D
• object3D: Object3D
= null
owner object3D
Inherited from
Defined in
src/components/ComponentBase.ts:17
isDestroyed
• Optional
isDestroyed: boolean
Inherited from
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
Inherited from
ComponentBase.eventDispatcher
Defined in
src/components/ComponentBase.ts:23
• set
eventDispatcher(value
): void
Parameters
Name | Type |
---|---|
value | CEventDispatcher |
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
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
Name | Type |
---|---|
value | boolean |
Returns
void
Defined in
src/components/Transform.ts:131
targetPos
• get
targetPos(): Vector3
Returns
Defined in
src/components/Transform.ts:136
• set
targetPos(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:139
parent
• get
parent(): Transform
Returns
Defined in
src/components/Transform.ts:143
• set
parent(value
): void
Parameters
Name | Type |
---|---|
value | Transform |
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
Name | Type |
---|---|
value | boolean |
Returns
void
Overrides
ComponentBase.enable
Defined in
src/components/Transform.ts:179
scene3D
• get
scene3D(): Scene3D
Returns
Defined in
src/components/Transform.ts:193
• set
scene3D(value
): void
Parameters
Name | Type |
---|---|
value | Scene3D |
Returns
void
Defined in
src/components/Transform.ts:197
view3D
• get
view3D(): View3D
Returns
Defined in
src/components/Transform.ts:201
up
• get
up(): Vector3
Returns
Defined in
src/components/Transform.ts:246
• set
up(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:251
down
• get
down(): Vector3
Returns
Defined in
src/components/Transform.ts:258
• set
down(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:263
forward
• get
forward(): Vector3
Returns
Defined in
src/components/Transform.ts:277
• set
forward(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:282
back
• get
back(): Vector3
Returns
Defined in
src/components/Transform.ts:296
• set
back(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:301
left
• get
left(): Vector3
Returns
Defined in
src/components/Transform.ts:308
• set
left(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:313
right
• get
right(): Vector3
Returns
Defined in
src/components/Transform.ts:320
• set
right(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
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
Defined in
src/components/Transform.ts:343
• set
localRotQuat(value
): void
Parameters
Name | Type |
---|---|
value | Quaternion |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
Returns
void
Defined in
src/components/Transform.ts:638
worldPosition
• get
worldPosition(): Vector3
world position
Returns
Defined in
src/components/Transform.ts:661
localPosition
• get
localPosition(): Vector3
The position of an object relative to its parent
Returns
Defined in
src/components/Transform.ts:689
• set
localPosition(v
): void
Parameters
Name | Type |
---|---|
v | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:668
localRotation
• get
localRotation(): Vector3
The rotaion vector of an object relative to its parent
Returns
Defined in
src/components/Transform.ts:714
• set
localRotation(v
): void
Parameters
Name | Type |
---|---|
v | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:693
localScale
• get
localScale(): Vector3
The scale of an object relative to its parent
Returns
Defined in
src/components/Transform.ts:735
• set
localScale(v
): void
Parameters
Name | Type |
---|---|
v | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:718
localDetailScale
• get
localDetailScale(): Vector3
Returns
Defined in
src/components/Transform.ts:740
• set
localDetailScale(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:744
localDetailRot
• get
localDetailRot(): Vector3
Returns
Defined in
src/components/Transform.ts:749
• set
localDetailRot(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:753
localDetailPos
• get
localDetailPos(): Vector3
Returns
Defined in
src/components/Transform.ts:758
• set
localDetailPos(value
): void
Parameters
Name | Type |
---|---|
value | Vector3 |
Returns
void
Defined in
src/components/Transform.ts:761
Methods
init
▸ init(param?
): void
Parameters
Name | Type |
---|---|
param? | any |
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:112
onEnable
▸ onEnable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:115
onDisable
▸ onDisable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:116
onUpdate
▸ onUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:117
onLateUpdate
▸ onLateUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:118
onBeforeUpdate
▸ onBeforeUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:119
onCompute
▸ onCompute(view?
, command?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
command? | GPUCommandEncoder |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:120
onGraphic
▸ onGraphic(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:121
onParentChange
▸ onParentChange(lastParent?
, currentParent?
): any
Parameters
Name | Type |
---|---|
lastParent? | Object3D |
currentParent? | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:122
onAddChild
▸ onAddChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:123
onRemoveChild
▸ onRemoveChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:124
copyComponent
▸ copyComponent(from
): this
Parameters
Name | Type |
---|---|
from | this |
Returns
this
Inherited from
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
Defined in
src/components/Transform.ts:225
stop
▸ stop(): void
Returns
void
Overrides
Defined in
src/components/Transform.ts:227
updateWorldMatrix
▸ updateWorldMatrix(force?
): void
Update the matrix4 in world space
Parameters
Name | Type | Default value |
---|---|---|
force | boolean | false |
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
Name | Type | Default value |
---|---|---|
target | Vector3 | undefined |
up | Vector3 | Vector3.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
Name | Type | Default value | Description |
---|---|---|---|
pos | Vector3 | undefined | Own position (global) |
target | Vector3 | undefined | Location of the target (global) |
up | Vector3 | Vector3.UP | up direction |
Returns
void
Defined in
src/components/Transform.ts:438
decomposeFromMatrix
▸ decomposeFromMatrix(matrix
, orientationStyle?
): this
Parameters
Name | Type | Default value |
---|---|---|
matrix | Matrix4 | undefined |
orientationStyle | string | '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
Name | Type | Description |
---|---|---|
obj | Object3D | source Object3D |
Returns
void
Overrides
Defined in
src/components/Transform.ts:471
beforeDestroy
▸ beforeDestroy(force?
): void
before release this component, object refrences are not be set null now.
Parameters
Name | Type |
---|---|
force? | boolean |
Returns
void
Overrides
Defined in
src/components/Transform.ts:767
destroy
▸ destroy(): void
release this component
Returns
void