Appearance
@tmrw-realityos/world / World
Class: World
Defined in: world/world.ts:30
World is a collection of Entities and Components. The nodes of the entities are managed in a scene hierachy.
Example
Populate the world from a json file
ts
// Construct an empty world
const world = new World();
// Load entities
world.load("room.json");Constructors
new World()
new World():
World
Defined in: world/world.ts:41
Create a new world with and empty entity.
Returns
Properties
boundNodes
boundNodes:
Map<string,BaseComponent[]>
Defined in: world/world.ts:36
fx
fx:
FXStack
Defined in: world/world.ts:34
rendererInterface?
optionalrendererInterface:RendererInterface
Defined in: world/world.ts:33
root
root:
Entity
Defined in: world/world.ts:31
scene
scene:
Scene
Defined in: world/world.ts:32
Methods
add()
add(
e):void
Defined in: world/world.ts:79
Adds an entity to the root node
Parameters
e
Returns
void
captureInput()
captureInput(
node,component):void
Defined in: world/world.ts:103
Parameters
node
string
component
Returns
void
configure()
configure(
data):void
Defined in: world/world.ts:56
Parameters
data
Returns
void
findComponent()
findComponent<
Type>(ctor):undefined|Type
Defined in: world/world.ts:84
Search a component in this entity and its children
Type Parameters
• Type extends BaseComponent
Parameters
ctor
(...args) => Type
Returns
undefined | Type
findEntityById()
findEntityById(
name):undefined|Entity
Defined in: world/world.ts:90
Parameters
name
string
Returns
undefined | Entity
findEntityByName()
findEntityByName(
name):undefined|Entity
Defined in: world/world.ts:94
Parameters
name
string
Returns
undefined | Entity
getBoundNodes()
getBoundNodes(
node):undefined|BaseComponent[]
Defined in: world/world.ts:99
used to connect components with nodes hosted by other entities
Parameters
node
string
Returns
undefined | BaseComponent[]
load()
load(
url):Promise<unknown>
Defined in: world/world.ts:121
loads one room
Parameters
url
string
Returns
Promise<unknown>
releaseInput()
releaseInput(
node,component):void
Defined in: world/world.ts:112
Parameters
node
string
component
Returns
void
update()
update(
dt):void
Defined in: world/world.ts:52
Parameters
dt
number
Returns
void