GameObjImpl
Defined in: packages/threeplay/src/core/gameobj.ts:46
Implementation of GameObjRaw. Components add their fields on top.
Implements
Section titled “Implements”Accessors
Section titled “Accessors”hidden
Section titled “hidden”Get Signature
Section titled “Get Signature”get hidden():
boolean
Defined in: packages/threeplay/src/core/gameobj.ts:66
Hides the object (and its subtree) without destroying it.
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set hidden(
h):void
Defined in: packages/threeplay/src/core/gameobj.ts:70
Hides the object (and its subtree) without destroying it.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Hides the object (and its subtree) without destroying it.
Implementation of
Section titled “Implementation of”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GameObjImpl(
ctx,object3d?):GameObjImpl
Defined in: packages/threeplay/src/core/gameobj.ts:60
Parameters
Section titled “Parameters”GameObjContext
object3d?
Section titled “object3d?”Object3D = ...
Returns
Section titled “Returns”GameObjImpl
Methods
Section titled “Methods”add<
T>(comps?):GameObj<MergeComps<T[number]>>
Defined in: packages/threeplay/src/core/gameobj.ts:74
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]>>
Implementation of
Section titled “Implementation of”c(
id):Comp|undefined
Defined in: packages/threeplay/src/core/gameobj.ts:166
The component with that id, if any.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Comp | undefined
Implementation of
Section titled “Implementation of”destroy()
Section titled “destroy()”destroy():
void
Defined in: packages/threeplay/src/core/gameobj.ts:88
Destroys this object and its subtree.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”exists()
Section titled “exists()”exists():
boolean
Defined in: packages/threeplay/src/core/gameobj.ts:106
false once destroyed.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”get(
tag,opts?):GameObj[]
Defined in: packages/threeplay/src/core/gameobj.ts:110
Descendants with the given tag(s).
Parameters
Section titled “Parameters”string | string[]
GetOpts = {}
Returns
Section titled “Returns”GameObj[]
Implementation of
Section titled “Implementation of”has(
id):boolean
Defined in: packages/threeplay/src/core/gameobj.ts:161
true if the object has a component with that id.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”inspect()
Section titled “inspect()”inspect():
Record<string,string>
Defined in: packages/threeplay/src/core/gameobj.ts:191
Status lines from every component, for debugging.
Returns
Section titled “Returns”Record<string, string>
Implementation of
Section titled “Implementation of”is(
tag):boolean
Defined in: packages/threeplay/src/core/gameobj.ts:123
true if the object has every given tag.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”on(
event,fn):EventController
Defined in: packages/threeplay/src/core/gameobj.ts:170
Listens to an event of this object.
Parameters
Section titled “Parameters”string
(…args) => void
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”onDestroy()
Section titled “onDestroy()”onDestroy(
fn):EventController
Defined in: packages/threeplay/src/core/gameobj.ts:187
Runs once when the object is destroyed.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”onFixedUpdate()
Section titled “onFixedUpdate()”onFixedUpdate(
fn):EventController
Defined in: packages/threeplay/src/core/gameobj.ts:183
Runs at the fixed rate while the object exists.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”onUpdate()
Section titled “onUpdate()”onUpdate(
fn):EventController
Defined in: packages/threeplay/src/core/gameobj.ts:179
Runs every frame while the object exists.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(
child):void
Defined in: packages/threeplay/src/core/gameobj.ts:84
Removes (destroys) a child.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”tag(
tag):void
Defined in: packages/threeplay/src/core/gameobj.ts:128
Adds tags.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”trigger()
Section titled “trigger()”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).
Parameters
Section titled “Parameters”string
…unknown[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”untag()
Section titled “untag()”untag(
tag):void
Defined in: packages/threeplay/src/core/gameobj.ts:132
Removes tags.
Parameters
Section titled “Parameters”string | string[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”unuse()
Section titled “unuse()”unuse(
id):void
Defined in: packages/threeplay/src/core/gameobj.ts:143
Removes a component by id.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”use(
comp):void
Defined in: packages/threeplay/src/core/gameobj.ts:136
Adds a component (or a tag) to a live object.
Parameters
Section titled “Parameters”string | object | Comp
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Properties
Section titled “Properties”children
Section titled “children”
readonlychildren:GameObj[] =[]
Defined in: packages/threeplay/src/core/gameobj.ts:50
Direct children.
Implementation of
Section titled “Implementation of”
readonlyid:number
Defined in: packages/threeplay/src/core/gameobj.ts:47
Unique, incremental id.
Implementation of
Section titled “Implementation of”object3d
Section titled “object3d”
readonlyobject3d:Object3D
Defined in: packages/threeplay/src/core/gameobj.ts:48
The three.js node of this object. Children objects are nested inside it.
Implementation of
Section titled “Implementation of”parent
Section titled “parent”parent:
GameObj|null=null
Defined in: packages/threeplay/src/core/gameobj.ts:49
Parent object (null for the root or once destroyed).
Implementation of
Section titled “Implementation of”paused
Section titled “paused”paused:
boolean=false
Defined in: packages/threeplay/src/core/gameobj.ts:52
A paused object (and its subtree) skips update and fixedUpdate.
Implementation of
Section titled “Implementation of”
readonlytags:Set<string>
Defined in: packages/threeplay/src/core/gameobj.ts:51
Tags of this object.