GameEntity
@zylem/game-lib / entity / GameEntity
Interface: GameEntity<O>
Defined in: packages/game-lib/src/lib/entities/entity.ts:187
Extends
BaseNode<O>
Extended by
ZylemBoxZylemSphereZylemSpriteZylemPlaneZylemZoneZylemActorZylemTextZylemRectZylemDiskZylemConeZylemPyramidZylemCylinderZylemPillZylemParticleSystemZylemLightZylemFogZylemLine
Type Parameters
O
O extends GameEntityOptions
Implements
GameEntityLifeCycleEntityDebugInfoMoveableEntityRotatableEntityAPI
Properties
_spawnInProgress
_spawnInProgress:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:284
True while StageEntityDelegate.spawnEntity is running for this entity.
_spawnPlacementPending
_spawnPlacementPending:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:278
Hide render target until spawn placement is confirmed.
_spawnPlacementReady
_spawnPlacementReady:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:282
setPosition / setPose assigned a spawn placement during this spawn.
_spawnPositionExplicit
_spawnPositionExplicit:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:280
Author passed position in create options.
body
body:
SimulationBody|null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:194
Implementation of
MoveableEntity.body
bodyDesc
bodyDesc:
SimulationBodyDefinition|null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:193
bundleKey
bundleKey:
string|null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:239
Bundle key for WebGPU bundle rendering (null if not bundled)
children
protectedchildren:NodeInterface[] =[]
Defined in: packages/game-lib/src/lib/core/base-node.ts:46
Inherited from
BaseNode.children
colliderBaseline
colliderBaseline:
SimulationColliderDefinition[] |null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:211
Pristine collider definitions captured before the first scale change, so scaling stays absolute rather than compounding. See ensureColliderBaseline.
colliderDesc
colliderDesc:
SimulationColliderDefinition|undefined
Defined in: packages/game-lib/src/lib/entities/entity.ts:203
colliderDescs
colliderDescs:
SimulationColliderDefinition[] =[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:221
All collider descriptions for this entity (including primary)
colliderScaleDirty
colliderScaleDirty:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:217
Set when GameEntity.setScale has scaled the render object but the colliders have not been rebuilt yet. Cleared by commitColliderScale.
collisionDelegate
collisionDelegate:
CollisionDelegate<GameEntity<O>,O>
Defined in: packages/game-lib/src/lib/entities/entity.ts:228
collisionType?
optionalcollisionType?:string
Defined in: packages/game-lib/src/lib/entities/entity.ts:233
compoundMeshes
compoundMeshes:
Mesh<BufferGeometry<NormalBufferAttributes,BufferGeometryEventMap>,Material<MaterialEventMap> |Material<MaterialEventMap>[],Object3DEventMap>[] =[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:223
Additional meshes for compound visual entities (added via add())
custom
custom:
Record<string,any> =\{\}
Defined in: packages/game-lib/src/lib/entities/entity.ts:204
debugInfo
debugInfo:
Record<string,any> =\{\}
Defined in: packages/game-lib/src/lib/entities/entity.ts:225
debugMaterial
debugMaterial:
ShaderMaterial|undefined
Defined in: packages/game-lib/src/lib/entities/entity.ts:226
eventDelegate
protectedeventDelegate:EventEmitterDelegate<EntityEvents>
Defined in: packages/game-lib/src/lib/entities/entity.ts:263
getPosition
getPosition: () =>
Vector|null
Defined in: packages/game-lib/src/lib/entities/entity.ts:297
Returns
Vector | null
Implementation of
MoveableEntity.getPosition
getRotation
getRotation: () =>
any
Defined in: packages/game-lib/src/lib/entities/entity.ts:319
Returns
any
Implementation of
RotatableEntityAPI.getRotation
getVelocity
getVelocity: () =>
Vector|null
Defined in: packages/game-lib/src/lib/entities/entity.ts:298
Returns
Vector | null
Implementation of
MoveableEntity.getVelocity
group
group:
Group<Object3DEventMap> |undefined
Defined in: packages/game-lib/src/lib/entities/entity.ts:190
Implementation of
RotatableEntityAPI.group
instanceId
instanceId:
number=-1
Defined in: packages/game-lib/src/lib/entities/entity.ts:241
Index within the instanced mesh pack
isBundled
isBundled:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:245
Whether this entity is drawn via a WebGPU render bundle
isInstanced
isInstanced:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:243
Whether this entity uses instanced rendering
lifecycleCallbacks
protectedlifecycleCallbacks:LifecycleCallbacks<any>
Defined in: packages/game-lib/src/lib/core/base-node.ts:58
Lifecycle callback arrays - use onSetup(), onUpdate(), etc. to add callbacks
Uses any for the type parameter to avoid invariance issues when subclasses
are assigned to BaseNode references. Type safety is enforced by the public
onSetup/onUpdate/etc. methods which are typed with this.
Inherited from
BaseNode.lifecycleCallbacks
markedForRemoval
markedForRemoval:
boolean=false
Defined in: packages/game-lib/src/lib/core/base-node.ts:50
Inherited from
BaseNode.markedForRemoval
materials
materials:
Material<MaterialEventMap>[] |undefined
Defined in: packages/game-lib/src/lib/entities/entity.ts:192
mesh
mesh:
Mesh<BufferGeometry<NormalBufferAttributes,BufferGeometryEventMap>,Material<MaterialEventMap> |Material<MaterialEventMap>[],Object3DEventMap> |undefined
Defined in: packages/game-lib/src/lib/entities/entity.ts:191
move
move: (
vector) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:294
Parameters
vector
Vector3
Returns
void
Implementation of
MoveableEntity.move
moveForwardXY
moveForwardXY: (
delta,rotation2DAngle) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:296
Parameters
delta
number
rotation2DAngle
number
Returns
void
Implementation of
MoveableEntity.moveForwardXY
moveX
moveX: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:289
Parameters
delta
number
Returns
void
Implementation of
MoveableEntity.moveX
moveXY
moveXY: (
deltaX,deltaY) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:292
Parameters
deltaX
number
deltaY
number
Returns
void
Implementation of
MoveableEntity.moveXY
moveXZ
moveXZ: (
deltaX,deltaZ) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:293
Parameters
deltaX
number
deltaZ
number
Returns
void
Implementation of
MoveableEntity.moveXZ
moveY
moveY: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:290
Parameters
delta
number
Returns
void
Implementation of
MoveableEntity.moveY
moveZ
moveZ: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:291
Parameters
delta
number
Returns
void
Implementation of
MoveableEntity.moveZ
name
name:
string=''
Defined in: packages/game-lib/src/lib/core/base-node.ts:49
Inherited from
BaseNode.name
options
options:
O
Defined in: packages/game-lib/src/lib/core/base-node.ts:47
Inherited from
BaseNode.options
packKey
packKey:
string|null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:237
Pack key for instanced rendering (null if not instanced)
parent
protectedparent:NodeInterface|null=null
Defined in: packages/game-lib/src/lib/core/base-node.ts:45
Inherited from
BaseNode.parent
physicsAttached
physicsAttached:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:195
physicsWorldRef
physicsWorldRef:
unknown=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:202
The physics world that currently owns this entity's body/colliders. Tagged on registration and checked on teardown so a stale world never frees handles another world now owns (which would poison the wasm simulation). Untyped to avoid a circular import.
resetVelocity
resetVelocity: () =>
void
Defined in: packages/game-lib/src/lib/entities/entity.ts:295
Returns
void
Implementation of
MoveableEntity.resetVelocity
rotateEuler
rotateEuler: (
eulerRotation) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:307
Parameters
eulerRotation
Vector3
Returns
void
Implementation of
RotatableEntityAPI.rotateEuler
rotateInDirection
rotateInDirection: (
moveVector) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:305
Parameters
moveVector
Vector3
Returns
void
Implementation of
RotatableEntityAPI.rotateInDirection
rotateX
rotateX: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:308
Parameters
delta
number
Returns
void
Implementation of
RotatableEntityAPI.rotateX
rotateY
rotateY: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:309
Parameters
delta
number
Returns
void
Implementation of
RotatableEntityAPI.rotateY
rotateYEuler
rotateYEuler: (
amount) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:306
Parameters
amount
number
Returns
void
Implementation of
RotatableEntityAPI.rotateYEuler
rotateZ
rotateZ: (
delta) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:310
Parameters
delta
number
Returns
void
Implementation of
RotatableEntityAPI.rotateZ
runtimeAttached
runtimeAttached:
boolean=false
Defined in: packages/game-lib/src/lib/entities/entity.ts:253
True once the entity has been spawned into the wasm simulation.
runtimeHandle
runtimeHandle:
number=-1
Defined in: packages/game-lib/src/lib/entities/entity.ts:251
Raw wasm slot index for this entity in the stage's Simulation; -1 when
not attached. Behavior systems address the runtime's slot-indexed buffers by
this slot.
setPosition
setPosition: (
x,y,z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:299
Parameters
x
number
y
number
z
number
Returns
void
Implementation of
MoveableEntity.setPosition
setPositionX
setPositionX: (
x) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:300
Parameters
x
number
Returns
void
Implementation of
MoveableEntity.setPositionX
setPositionY
setPositionY: (
y) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:301
Parameters
y
number
Returns
void
Implementation of
MoveableEntity.setPositionY
setPositionZ
setPositionZ: (
z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:302
Parameters
z
number
Returns
void
Implementation of
MoveableEntity.setPositionZ
setRotation
setRotation: (
x,y,z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:318
Parameters
x
number
y
number
z
number
Returns
void
Implementation of
RotatableEntityAPI.setRotation
setRotationDegrees
setRotationDegrees: (
x,y,z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:314
Parameters
x
number
y
number
z
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationDegrees
setRotationDegreesX
setRotationDegreesX: (
x) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:316
Parameters
x
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationDegreesX
setRotationDegreesY
setRotationDegreesY: (
y) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:315
Parameters
y
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationDegreesY
setRotationDegreesZ
setRotationDegreesZ: (
z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:317
Parameters
z
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationDegreesZ
setRotationX
setRotationX: (
x) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:312
Parameters
x
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationX
setRotationY
setRotationY: (
y) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:311
Parameters
y
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationY
setRotationZ
setRotationZ: (
z) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:313
Parameters
z
number
Returns
void
Implementation of
RotatableEntityAPI.setRotationZ
transformStore
transformStore:
TransformState
Defined in: packages/game-lib/src/lib/entities/entity.ts:272
Implementation of
MoveableEntity.transformStore
uuid
uuid:
string=''
Defined in: packages/game-lib/src/lib/core/base-node.ts:48
Inherited from
BaseNode.uuid
wasmStageRef
wasmStageRef:
BehaviorRuntime|null=null
Defined in: packages/game-lib/src/lib/entities/entity.ts:260
The stage simulation's low-level runtime adapter. Set by
ZylemWorld.addEntity() so GameEntity.getPose /
GameEntity.setPose and behavior descriptors can route through
the runtime without threading the handle around.
wrapAround3D
wrapAround3D: (
boundsX,boundsY,boundsZ) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:304
Parameters
boundsX
number
boundsY
number
boundsZ
number
Returns
void
Implementation of
MoveableEntity.wrapAround3D
wrapAroundXY
wrapAroundXY: (
boundsX,boundsY) =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:303
Parameters
boundsX
number
boundsY
number
Returns
void
Implementation of
MoveableEntity.wrapAroundXY
Methods
_cleanup()
protected_cleanup(_params):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:925
Engine-internal resource cleanup -- runs automatically after destroy. Disposes GPU/DOM resources (meshes, materials, debug material).
Note: actions, collision callbacks, and behavior refs are intentionally NOT cleared here -- they are registered by consumer code at module level and must persist across stage reloads. Actions are reset in _setup().
Parameters
_params
CleanupContext<GameEntity<O>>
Returns
void
Overrides
BaseNode._cleanup
_collision()
_collision(
other,globals?,dispatch?):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:952
Parameters
other
GameEntity<O>
globals?
any
dispatch?
CollisionDispatchMetadata = ...
Returns
void
_destroy()
_destroy(
params):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:915
Entity-specific destroy -- reserved for consumer game logic. Engine-internal resource disposal runs in _cleanup() instead.
Parameters
params
DestroyContext<GameEntity<O>>
Returns
void
Implementation of
GameEntityLifeCycle._destroy
Overrides
BaseNode._destroy
_loaded()
protected_loaded(_params):Promise<void>
Defined in: packages/game-lib/src/lib/entities/entity.ts:900
Parameters
_params
LoadedContext<GameEntity<O>>
Returns
Promise<void>
Overrides
BaseNode._loaded
_setup()
_setup(
params):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:886
Entity-specific setup - resets actions for a fresh stage session. (User callbacks are handled by BaseNode's lifecycleCallbacks.setup)
Parameters
params
SetupContext<GameEntity<O>>
Returns
void
Implementation of
GameEntityLifeCycle._setup
Overrides
BaseNode._setup
_tickActions()
_tickActions(
delta):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:614
Tick all registered actions. Called automatically before user onUpdate callbacks.
Resets velocity/angularVelocity accumulation before ticking so that
actions can compose via += without cross-frame build-up.
(The existing move helpers like moveXY use = which doesn't accumulate,
but action composition needs additive writes on a clean slate each frame.)
Parameters
delta
number
Returns
void
_update()
_update(
params):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:907
Entity-specific update - updates materials. Transform changes are applied by the stage after all update callbacks complete. (User callbacks are handled by BaseNode's lifecycleCallbacks.update)
Parameters
params
UpdateContext<GameEntity<O>>
Returns
void
Implementation of
GameEntityLifeCycle._update
Overrides
BaseNode._update
action()
action<
A>(action):A
Defined in: packages/game-lib/src/lib/entities/entity.ts:595
Register a persistent action (throttle, onPress). Not removed when done.
Type Parameters
A
A extends Action
Parameters
action
A
Returns
A
Example
`const press = entity.action(onPress())`
add()
add(...
components):this
Defined in: packages/game-lib/src/lib/entities/entity.ts:500
Add meshes, collision components, or child entities to this entity.
Supports fluent chaining: entity.add(boxMesh()).add(boxCollision()).
Mesh: First mesh becomes the primary mesh; subsequent meshes are compound meshes grouped together.CollisionComponent: First sets bodyDesc + colliderDesc; subsequent add extra colliders to the same rigid body.NodeInterface: Added as a child entity (delegates to BaseNode.add).
Parameters
components
...(NodeInterface | Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap> | CollisionComponent)[]
Returns
this
Overrides
BaseNode.add
buildInfo()
buildInfo():
Record<string,string>
Defined in: packages/game-lib/src/lib/entities/entity.ts:1079
Returns
Record<string, string>
Implementation of
EntityDebugInfo.buildInfo
clearActions()
clearActions():
void
Defined in: packages/game-lib/src/lib/entities/entity.ts:602
Remove all registered actions (fire-and-forget and persistent).
Returns
void
clone()
clone(
overrides?):this
Defined in: packages/game-lib/src/lib/entities/entity.ts:654
Parameters
overrides?
Partial<O>
Returns
this
cloneChildrenInto()
protectedcloneChildrenInto(target):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:215
Parameters
target
BaseNode<any, any>
Returns
void
Inherited from
BaseNode.cloneChildrenInto
create()
create():
this
Defined in: packages/game-lib/src/lib/entities/entity.ts:649
Returns
this
Overrides
BaseNode.create
dispatch()
dispatch<
K>(event,payload):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:1094
Dispatch an event from this entity. Events are emitted both locally and to the global event bus.
Type Parameters
K
K extends keyof EntityEvents
Parameters
event
K
payload
EntityEvents[K]
Returns
void
disposeEvents()
disposeEvents():
void
Defined in: packages/game-lib/src/lib/entities/entity.ts:1116
Clean up entity event subscriptions.
Returns
void
enableUserLifecycleTracking()
enableUserLifecycleTracking():
void
Defined in: packages/game-lib/src/lib/core/base-node.ts:176
Returns
void
Inherited from
BaseNode.enableUserLifecycleTracking
finalizeCloneSupport()
finalizeCloneSupport(
factory):this
Defined in: packages/game-lib/src/lib/entities/entity.ts:694
Parameters
factory
(options?) => GameEntity<O>
Returns
this
getBehaviorRef()
getBehaviorRef<
O>(descriptor):BehaviorRef<O> |null
Defined in: packages/game-lib/src/lib/entities/entity.ts:806
Find the attached ref for a behavior, matched by descriptor key so a re-imported copy of the same descriptor still resolves.
Type Parameters
O
O extends Record<string, any>
Parameters
descriptor
BehaviorDescriptor<O, any>
Returns
BehaviorRef<O> | null
getBehaviorRefs()
getBehaviorRefs():
BehaviorRef<Record<string,any>>[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:798
Get all behavior references attached to this entity. Used by the stage to auto-register required systems.
Returns
BehaviorRef<Record<string, any>>[]
getChildren()
getChildren():
NodeInterface[]
Defined in: packages/game-lib/src/lib/core/base-node.ts:168
Returns
NodeInterface[]
Inherited from
BaseNode.getChildren
getCollisionCallbacks()
getCollisionCallbacks(): (
params) =>void[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:856
Returns
(params) => void[]
getCollisionRegistrations()
getCollisionRegistrations():
CollisionRegistration<GameEntity<O>,O>[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:860
Returns
CollisionRegistration<GameEntity<O>, O>[]
getMaterials()
getMaterials():
Material<MaterialEventMap>[]
Defined in: packages/game-lib/src/lib/entities/entity.ts:1002
The materials currently driving this entity's meshes.
Returns
Material<MaterialEventMap>[]
getOptions()
getOptions():
O
Defined in: packages/game-lib/src/lib/core/base-node.ts:317
Returns
O
Inherited from
BaseNode.getOptions
getParent()
getParent():
NodeInterface|null
Defined in: packages/game-lib/src/lib/core/base-node.ts:151
Returns
NodeInterface | null
Inherited from
BaseNode.getParent
getPose()
getPose(): \{
position:Vec3;rotation: \{w:number;x:number;y:number;z:number; \}; \} |null
Defined in: packages/game-lib/src/lib/entities/entity.ts:404
Read the entity's pose from the wasm simulation. Returns null when
the entity has not been spawned into the runtime yet.
Returns
\{ position: Vec3; rotation: \{ w: number; x: number; y: number; z: number; \}; \} | null
getScale()
getScale():
Vec3
Defined in: packages/game-lib/src/lib/entities/entity.ts:467
Current absolute scale.
Returns
hasBehavior()
hasBehavior(
descriptor):boolean
Defined in: packages/game-lib/src/lib/entities/entity.ts:816
Parameters
descriptor
BehaviorDescriptor<any, any>
Returns
boolean
hasMaterial()
hasMaterial():
boolean
Defined in: packages/game-lib/src/lib/entities/entity.ts:997
Whether this entity renders a mesh that a material can be assigned to.
Lights, zones, and other mesh-less entities return false.
Returns
boolean
isComposite()
isComposite():
boolean
Defined in: packages/game-lib/src/lib/core/base-node.ts:172
Returns
boolean
Inherited from
BaseNode.isComposite
listen()
listen<
K>(event,handler): () =>void
Defined in: packages/game-lib/src/lib/entities/entity.ts:1106
Listen for events on this entity instance.
Type Parameters
K
K extends keyof EntityEvents
Parameters
event
K
handler
(payload) => void
Returns
Unsubscribe function
() => void
nodeCleanup()
nodeCleanup(
params):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:303
Parameters
params
CleanupContext<GameEntity<O>>
Returns
void
Inherited from
BaseNode.nodeCleanup
nodeDestroy()
nodeDestroy(
params):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:270
Parameters
params
DestroyContext<GameEntity<O>>
Returns
void
Inherited from
BaseNode.nodeDestroy
nodeLoaded()
nodeLoaded(
params):Promise<void>
Defined in: packages/game-lib/src/lib/core/base-node.ts:294
Parameters
params
LoadedContext<GameEntity<O>>
Returns
Promise<void>
Inherited from
BaseNode.nodeLoaded
nodeSetup()
nodeSetup(
params):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:241
Parameters
params
SetupContext<GameEntity<O>>
Returns
void
Inherited from
BaseNode.nodeSetup
nodeUpdate()
nodeUpdate(
params):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:253
Parameters
params
UpdateContext<GameEntity<O>>
Returns
void
Inherited from
BaseNode.nodeUpdate
onCleanup()
onCleanup(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:119
Add cleanup callbacks to be executed in order during nodeCleanup
Parameters
callbacks
...CleanupFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.onCleanup
onCollision()
Call Signature
onCollision(
callback,options?):this
Defined in: packages/game-lib/src/lib/entities/entity.ts:704
Add collision callbacks
Parameters
callback
(params) => void
options?
CollisionRegistrationOptions
Returns
this
Call Signature
onCollision(...
callbacks):this
Defined in: packages/game-lib/src/lib/entities/entity.ts:708
Add collision callbacks
Parameters
callbacks
...(params) => void[]
Returns
this
onDestroy()
onDestroy(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:110
Add destroy callbacks to be executed in order during nodeDestroy
Parameters
callbacks
...DestroyFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.onDestroy
onLoaded()
onLoaded(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:92
Add loaded callbacks to be executed in order during nodeLoaded
Parameters
callbacks
...LoadedFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.onLoaded
onSetup()
onSetup(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:83
Add setup callbacks to be executed in order during nodeSetup
Parameters
callbacks
...SetupFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.onSetup
onUpdate()
onUpdate(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:101
Add update callbacks to be executed in order during nodeUpdate
Parameters
callbacks
...UpdateFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.onUpdate
prependSetup()
prependSetup(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:128
Prepend setup callbacks (run before existing ones)
Parameters
callbacks
...SetupFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.prependSetup
prependUpdate()
prependUpdate(...
callbacks):this
Defined in: packages/game-lib/src/lib/core/base-node.ts:137
Prepend update callbacks (run before existing ones)
Parameters
callbacks
...UpdateFunction<GameEntity<O>, any>[]
Returns
this
Inherited from
BaseNode.prependUpdate
remove()
remove(
baseNode):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:160
Parameters
baseNode
NodeInterface
Returns
void
Inherited from
BaseNode.remove
removeBehavior()
removeBehavior(
target):BehaviorRef<any> |null
Defined in: packages/game-lib/src/lib/entities/entity.ts:831
Detach a behavior from this entity.
Removes the ref so future spawns skip it. If the entity is live in a
stage, the stage must also drop the system link (see
StageEntityDelegate.detachBehaviorLink); StageDebugDelegate does this
for editor-driven removals.
Parameters
target
BehaviorRef<any> | BehaviorDescriptor<any, any, unknown>
The descriptor (matched by key) or the exact ref to remove.
Returns
BehaviorRef<any> | null
The removed ref, or null when nothing matched.
replaceMaterials()
replaceMaterials(
materials,settings?):Material<MaterialEventMap>[] |null
Defined in: packages/game-lib/src/lib/entities/entity.ts:1035
Assign already-built materials to every mesh this entity renders. Meshes that carried a material array keep the array shape, cycling through the supplied list so multi-material geometry stays fully covered.
Parameters
materials
Material<MaterialEventMap>[]
settings?
disposePrevious?
boolean
Returns
Material<MaterialEventMap>[] | null
The replaced materials, or null when the entity has no mesh.
replayUserLifecycleRegistrationsTo()
protectedreplayUserLifecycleRegistrationsTo(target,wrap?):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:180
Parameters
target
BaseNode<any, any>
wrap?
<T>(callback) => T
Returns
void
Inherited from
BaseNode.replayUserLifecycleRegistrationsTo
restoreBehaviorRef()
restoreBehaviorRef(
ref):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:850
Re-attach a previously removed ref as-is (options, FSM state and all). Used by undo so a restored behavior is the same object, not a re-created one.
Parameters
ref
BehaviorRef<any>
Returns
void
reveal()
reveal():
void
Defined in: packages/game-lib/src/lib/entities/entity.ts:395
Make the entity visible, clearing spawn placement pending state.
Returns
void
runAction()
runAction<
A>(action):A
Defined in: packages/game-lib/src/lib/entities/entity.ts:586
Run a fire-and-forget action. Auto-removed when done.
Type Parameters
A
A extends Action
Parameters
action
A
Returns
A
Example
`me.runAction(moveBy({ x: 10, duration: 0.3 }))`
setMaterial()
setMaterial(
options,settings?):Material<MaterialEventMap>[] |null
Defined in: packages/game-lib/src/lib/entities/entity.ts:1016
Rebuild this entity's material from creation-style options and swap it in
on the live mesh, so a runtime change (an editor applying a shader swatch)
renders exactly like a restart with material: options would.
Parameters
options
Partial<MaterialOptions>
Same shape as GameEntityOptions.material.
settings?
disposePrevious (default true) frees the replaced
materials; pass false when keeping them for undo.
disposePrevious?
boolean
Returns
Material<MaterialEventMap>[] | null
The replaced materials, or null when the entity has no mesh.
setOptions()
setOptions(
options):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:321
Parameters
options
Partial<Options>
Returns
void
Inherited from
BaseNode.setOptions
setParent()
setParent(
parent):void
Defined in: packages/game-lib/src/lib/core/base-node.ts:147
Parameters
parent
NodeInterface | null
Returns
void
Inherited from
BaseNode.setParent
setPose()
setPose(
input):boolean
Defined in: packages/game-lib/src/lib/entities/entity.ts:430
Write the entity's pose into the wasm simulation.
Either or both of position and rotation may be omitted to leave
that component unchanged.
Parameters
input
position?
rotation?
\{ w: number; x: number; y: number; z: number; \}
rotation.w
number
rotation.x
number
rotation.y
number
rotation.z
number
Returns
boolean
setScale()
setScale(
x,y,z):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:479
Set absolute scale on the render object.
Colliders are not resized here — they are baked into the wasm simulation and can only be replaced by respawning the body, which is far too costly to do per drag frame. The entity is flagged instead, and commitColliderScale rebuilds them once the gesture commits.
Parameters
x
number
y
number
z
number
Returns
void
updateMaterials()
protectedupdateMaterials(params):void
Defined in: packages/game-lib/src/lib/entities/entity.ts:1065
Parameters
params
any
Returns
void
use()
use<
O,H>(descriptor,options?):BehaviorHandle<O,H>
Defined in: packages/game-lib/src/lib/entities/entity.ts:765
Use a behavior on this entity via typed descriptor. Behaviors will be auto-registered as systems when the entity is spawned.
Type Parameters
O
O extends Record<string, any>
H
H extends Record<string, any> = Record<string, never>
Parameters
descriptor
BehaviorDescriptor<O, H>
The behavior descriptor (import from behaviors module)
options?
Partial<O>
Optional overrides for the behavior's default options
Returns
BehaviorHandle<O, H>
BehaviorHandle with behavior-specific methods for lazy FSM access