GameObjRaw
Defined in: packages/threeplay/src/core/types.ts:98
The methods every game object has, whatever its components.
Methods
Section titled “Methods”add<
T>(comps?):GameObj<MergeComps<T[number]>>
Defined in: packages/threeplay/src/core/types.ts:115
Adds a child object.
Type Parameters
Section titled “Type Parameters”T extends CompList
Parameters
Section titled “Parameters”comps?
Section titled “comps?”readonly [T]
Returns
Section titled “Returns”GameObj<MergeComps<T[number]>>
c(
id):Comp|undefined
Defined in: packages/threeplay/src/core/types.ts:137
The component with that id, if any.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Comp | undefined
destroy()
Section titled “destroy()”destroy():
void
Defined in: packages/threeplay/src/core/types.ts:119
Destroys this object and its subtree.
Returns
Section titled “Returns”void
exists()
Section titled “exists()”exists():
boolean
Defined in: packages/threeplay/src/core/types.ts:121
false once destroyed.
Returns
Section titled “Returns”boolean
get(
tag,opts?):GameObj<Record<string,any>>[]
Defined in: packages/threeplay/src/core/types.ts:123
Descendants with the given tag(s).
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”GameObj<Record<string, any>>[]
has(
id):boolean
Defined in: packages/threeplay/src/core/types.ts:135
true if the object has a component with that id.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”boolean
inspect()
Section titled “inspect()”inspect():
Record<string,string>
Defined in: packages/threeplay/src/core/types.ts:149
Status lines from every component, for debugging.
Returns
Section titled “Returns”Record<string, string>
is(
tag):boolean
Defined in: packages/threeplay/src/core/types.ts:125
true if the object has every given tag.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”boolean
on(
event,fn):EventController
Defined in: packages/threeplay/src/core/types.ts:139
Listens to an event of this object.
Parameters
Section titled “Parameters”string
(…args) => void
Returns
Section titled “Returns”onDestroy()
Section titled “onDestroy()”onDestroy(
fn):EventController
Defined in: packages/threeplay/src/core/types.ts:147
Runs once when the object is destroyed.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”onFixedUpdate()
Section titled “onFixedUpdate()”onFixedUpdate(
fn):EventController
Defined in: packages/threeplay/src/core/types.ts:145
Runs at the fixed rate while the object exists.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”onUpdate()
Section titled “onUpdate()”onUpdate(
fn):EventController
Defined in: packages/threeplay/src/core/types.ts:143
Runs every frame while the object exists.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”remove()
Section titled “remove()”remove(
child):void
Defined in: packages/threeplay/src/core/types.ts:117
Removes (destroys) a child.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
tag(
tag):void
Defined in: packages/threeplay/src/core/types.ts:127
Adds tags.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”void
trigger()
Section titled “trigger()”trigger(
event, …args):void
Defined in: packages/threeplay/src/core/types.ts:141
Emits an event on this object (also reaches k.on(event, tag, fn) listeners).
Parameters
Section titled “Parameters”string
…unknown[]
Returns
Section titled “Returns”void
untag()
Section titled “untag()”untag(
tag):void
Defined in: packages/threeplay/src/core/types.ts:129
Removes tags.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”void
unuse()
Section titled “unuse()”unuse(
id):void
Defined in: packages/threeplay/src/core/types.ts:133
Removes a component by id.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
use(
comp):void
Defined in: packages/threeplay/src/core/types.ts:131
Adds a component (or a tag) to a live object.
Parameters
Section titled “Parameters”string | object | Comp
Returns
Section titled “Returns”void
Properties
Section titled “Properties”children
Section titled “children”
readonlychildren: readonlyGameObj<Record<string,any>>[]
Defined in: packages/threeplay/src/core/types.ts:106
Direct children.
hidden
Section titled “hidden”hidden:
boolean
Defined in: packages/threeplay/src/core/types.ts:112
Hides the object (and its subtree) without destroying it.
readonlyid:number
Defined in: packages/threeplay/src/core/types.ts:100
Unique, incremental id.
object3d
Section titled “object3d”
readonlyobject3d:Object3D
Defined in: packages/threeplay/src/core/types.ts:102
The three.js node of this object. Children objects are nested inside it.
parent
Section titled “parent”
readonlyparent:GameObj<Record<string,any>> |null
Defined in: packages/threeplay/src/core/types.ts:104
Parent object (null for the root or once destroyed).
paused
Section titled “paused”paused:
boolean
Defined in: packages/threeplay/src/core/types.ts:110
A paused object (and its subtree) skips update and fixedUpdate.
readonlytags:ReadonlySet<string>
Defined in: packages/threeplay/src/core/types.ts:108
Tags of this object.