Skip to content

GameObjImpl

Defined in: packages/threeplay/src/core/gameobj.ts:46

Implementation of GameObjRaw. Components add their fields on top.

get hidden(): boolean

Defined in: packages/threeplay/src/core/gameobj.ts:66

Hides the object (and its subtree) without destroying it.

boolean

set hidden(h): void

Defined in: packages/threeplay/src/core/gameobj.ts:70

Hides the object (and its subtree) without destroying it.

boolean

void

Hides the object (and its subtree) without destroying it.

GameObjRaw.hidden

new GameObjImpl(ctx, object3d?): GameObjImpl

Defined in: packages/threeplay/src/core/gameobj.ts:60

GameObjContext

Object3D = ...

GameObjImpl

add<T>(comps?): GameObj<MergeComps<T[number]>>

Defined in: packages/threeplay/src/core/gameobj.ts:74

Adds a child object.

T extends CompList

readonly [T] = ...

GameObj<MergeComps<T[number]>>

GameObjRaw.add


c(id): Comp | undefined

Defined in: packages/threeplay/src/core/gameobj.ts:166

The component with that id, if any.

string

Comp | undefined

GameObjRaw.c


destroy(): void

Defined in: packages/threeplay/src/core/gameobj.ts:88

Destroys this object and its subtree.

void

GameObjRaw.destroy


exists(): boolean

Defined in: packages/threeplay/src/core/gameobj.ts:106

false once destroyed.

boolean

GameObjRaw.exists


get(tag, opts?): GameObj[]

Defined in: packages/threeplay/src/core/gameobj.ts:110

Descendants with the given tag(s).

string | string[]

GetOpts = {}

GameObj[]

GameObjRaw.get


has(id): boolean

Defined in: packages/threeplay/src/core/gameobj.ts:161

true if the object has a component with that id.

string | string[]

boolean

GameObjRaw.has


inspect(): Record<string, string>

Defined in: packages/threeplay/src/core/gameobj.ts:191

Status lines from every component, for debugging.

Record<string, string>

GameObjRaw.inspect


is(tag): boolean

Defined in: packages/threeplay/src/core/gameobj.ts:123

true if the object has every given tag.

string | string[]

boolean

GameObjRaw.is


on(event, fn): EventController

Defined in: packages/threeplay/src/core/gameobj.ts:170

Listens to an event of this object.

string

(…args) => void

EventController

GameObjRaw.on


onDestroy(fn): EventController

Defined in: packages/threeplay/src/core/gameobj.ts:187

Runs once when the object is destroyed.

() => void

EventController

GameObjRaw.onDestroy


onFixedUpdate(fn): EventController

Defined in: packages/threeplay/src/core/gameobj.ts:183

Runs at the fixed rate while the object exists.

() => void

EventController

GameObjRaw.onFixedUpdate


onUpdate(fn): EventController

Defined in: packages/threeplay/src/core/gameobj.ts:179

Runs every frame while the object exists.

() => void

EventController

GameObjRaw.onUpdate


remove(child): void

Defined in: packages/threeplay/src/core/gameobj.ts:84

Removes (destroys) a child.

GameObj

void

GameObjRaw.remove


tag(tag): void

Defined in: packages/threeplay/src/core/gameobj.ts:128

Adds tags.

string | string[]

void

GameObjRaw.tag


trigger(event, …args): void

Defined in: packages/threeplay/src/core/gameobj.ts:174

Emits an event on this object (also reaches k.on(event, tag, fn) listeners).

string

…unknown[]

void

GameObjRaw.trigger


untag(tag): void

Defined in: packages/threeplay/src/core/gameobj.ts:132

Removes tags.

string | string[]

void

GameObjRaw.untag


unuse(id): void

Defined in: packages/threeplay/src/core/gameobj.ts:143

Removes a component by id.

string

void

GameObjRaw.unuse


use(comp): void

Defined in: packages/threeplay/src/core/gameobj.ts:136

Adds a component (or a tag) to a live object.

string | object | Comp

void

GameObjRaw.use

readonly children: GameObj[] = []

Defined in: packages/threeplay/src/core/gameobj.ts:50

Direct children.

GameObjRaw.children


readonly id: number

Defined in: packages/threeplay/src/core/gameobj.ts:47

Unique, incremental id.

GameObjRaw.id


readonly object3d: Object3D

Defined in: packages/threeplay/src/core/gameobj.ts:48

The three.js node of this object. Children objects are nested inside it.

GameObjRaw.object3d


parent: GameObj | null = null

Defined in: packages/threeplay/src/core/gameobj.ts:49

Parent object (null for the root or once destroyed).

GameObjRaw.parent


paused: boolean = false

Defined in: packages/threeplay/src/core/gameobj.ts:52

A paused object (and its subtree) skips update and fixedUpdate.

GameObjRaw.paused


readonly tags: Set<string>

Defined in: packages/threeplay/src/core/gameobj.ts:51

Tags of this object.

GameObjRaw.tags