StateComp
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:32
Fields added by state(): a small finite state machine.
Extends
Section titled “Extends”Methods
Section titled “Methods”add()?
Section titled “add()?”
optionaladd(this):void
Defined in: packages/threeplay/src/core/types.ts:63
Called when the object enters the scene (or when used on a live object).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”destroy()?
Section titled “destroy()?”
optionaldestroy(this):void
Defined in: packages/threeplay/src/core/types.ts:69
Called when the object is destroyed or the component removed.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”enterState()
Section titled “enterState()”enterState(
name, …args):void
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:37
Leaves the current state (running its onStateEnd handlers) and enters name, passing args to its enter handlers. Throws for names outside allowed.
Parameters
Section titled “Parameters”string
…unknown[]
Returns
Section titled “Returns”void
fixedUpdate()?
Section titled “fixedUpdate()?”
optionalfixedUpdate(this):void
Defined in: packages/threeplay/src/core/types.ts:67
Called at the fixed physics rate (50 Hz by default).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”inspect()?
Section titled “inspect()?”
optionalinspect(this):string|null|undefined
Defined in: packages/threeplay/src/core/types.ts:71
Short status line shown by the debug inspector.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string | null | undefined
Inherited from
Section titled “Inherited from”onStateEnd()
Section titled “onStateEnd()”onStateEnd(
name,fn):EventController
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:44
Runs when name is left.
Parameters
Section titled “Parameters”string
() => void
Returns
Section titled “Returns”onStateEnter()
Section titled “onStateEnter()”onStateEnter(
name,fn):EventController
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:42
Runs when name is entered. The initial state is entered on the first
frame, so handlers registered right after add([...]) still see it.
Parameters
Section titled “Parameters”string
(…args) => void
Returns
Section titled “Returns”onStateUpdate()
Section titled “onStateUpdate()”onStateUpdate(
name,fn):EventController
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:46
Runs every frame while name is the current state (not while the object is paused).
Parameters
Section titled “Parameters”string
() => void
Returns
Section titled “Returns”update()?
Section titled “update()?”
optionalupdate(this):void
Defined in: packages/threeplay/src/core/types.ts:65
Called once per frame.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”conflicts?
Section titled “conflicts?”
optionalconflicts?:string[]
Defined in: packages/threeplay/src/core/types.ts:61
Ids of components that can’t be on the same object (checked both ways).
Inherited from
Section titled “Inherited from”id:
"state"
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:33
Unique name. Two components with the same id replace each other.
Overrides
Section titled “Overrides”require?
Section titled “require?”
optionalrequire?:string[]
Defined in: packages/threeplay/src/core/types.ts:59
Ids of components that must be present on the object.
Inherited from
Section titled “Inherited from”state:
string
Defined in: packages/threeplay/src/plugins/gameplay/types.ts:35
Name of the current state. Assigning to it calls enterState.