Appearance
@tmrw-realityos/world • Docs
@tmrw-realityos/world / Entity
Class: Entity
Entity class is the main class to build Worlds. Entities define objects scattered around the 3D space. Every Entity contains components that define its behaviour:
- Render a 3D mesh
- Play sound
- Interact with the user
- etc...
Check the components pool for further information.
Entities can also contain other entities inside.
Extends
Constructors
new Entity()
new Entity():
Entity
Returns
Overrides
ComponentsContainer.constructor
Defined in
Properties
children
children:
Entity[] =[]
Defined in
components
components:
BaseComponent[] =[]
Inherited from
ComponentsContainer.components
Defined in
enabled
enabled:
boolean=true
Defined in
index
index:
number=-1
Defined in
is_root
is_root:
boolean=false
Defined in
layers
layers:
number=3
Defined in
name
name:
string=""
Defined in
node
node:
Node
Defined in
parent?
optionalparent:Entity
Defined in
uid
uid:
string=""
Defined in
world?
optionalworld:World
Defined in
last_index
staticlast_index:number=0
Defined in
Accessors
transform
gettransform():Transform
Returns
Transform
Defined in
Methods
addChild()
addChild(
child):void
Parameters
• child: Entity
Returns
void
Defined in
addComponent()
addComponent(
component):void
Parameters
• component: BaseComponent
Returns
void
Inherited from
ComponentsContainer.addComponent
Defined in
clear()
clear():
void
Returns
void
Defined in
configure()
configure(
o):void
Parameters
• o: EntityDescriptor
Returns
void
Defined in
configureComponents()
configureComponents(
info):void
Parameters
• info
• info.components?: [string, BaseComponent][]
Returns
void
Inherited from
ComponentsContainer.configureComponents
Defined in
executeMethodInComponents()
executeMethodInComponents(
func_name,data):void
executes function with a given name in this component and in all children entities components
Parameters
• func_name: string
• data: unknown
Returns
void
Defined in
findChildById()
findChildById(
uid):undefined|Entity
Parameters
• uid: string
Returns
undefined | Entity
Defined in
findChildByName()
findChildByName(
name):undefined|Entity
Parameters
• name: string
Returns
undefined | Entity
Defined in
findComponent()
findComponent<
Type>(ctor):undefined|Type
Search a component in this entity and its children Usage: entity.getComponent( PrefabRenderer );
Type Parameters
• Type extends BaseComponent
Parameters
• ctor
Returns
undefined | Type
Defined in
findComponentByName()
findComponentByName(
class_name):undefined|BaseComponent
Search a component in this entity and its children
Parameters
• class_name: string
Returns
undefined | BaseComponent
Defined in
getComponent()
getComponent<
Type>(ctor):undefined|Type
Type Parameters
• Type extends BaseComponent
Parameters
• ctor
Returns
undefined | Type
Inherited from
ComponentsContainer.getComponent
Defined in
getComponentByName()
getComponentByName(
class_name):undefined|BaseComponent
Parameters
• class_name: string
Returns
undefined | BaseComponent
Inherited from
ComponentsContainer.getComponentByName
Defined in
onAddedToWorld()
onAddedToWorld(
_w):void
Parameters
• _w: World
Returns
void
Defined in
onClick()
onClick():
void
executes the action of onClick in all components
Returns
void
Defined in
onUpdate()?
optionalonUpdate(dt):void
Parameters
• dt: number
Returns
void
Defined in
removeAllComponents()
removeAllComponents():
void
Returns
void
Inherited from
ComponentsContainer.removeAllComponents
Defined in
removeChild()
removeChild(
child):void
Parameters
• child: Entity
Returns
void
Defined in
removeComponent()
removeComponent(
component):void
Parameters
• component: BaseComponent
Returns
void
Inherited from
ComponentsContainer.removeComponent
Defined in
serialize()
serialize():
void
Returns
void
Defined in
update()
update(
dt):void
propagate the update action into components and children
Parameters
• dt: number
Returns
void