Skip to content

ColliderComponent

Defined in: physics/src/ColliderComponent.ts:19

Wraps a Rapier collider. Attach after RigidBodyComponent.

Component ordering: Transform → RigidBodyComponent → ColliderComponent.

  • Component

new ColliderComponent(config): ColliderComponent

Defined in: physics/src/ColliderComponent.ts:31

ColliderConfig

ColliderComponent

Component.constructor

_colliderHandle: number = -1

Defined in: physics/src/ColliderComponent.ts:24

Internal

Rapier collider handle, set during onAdd.


readonly config: ColliderConfig

Defined in: physics/src/ColliderComponent.ts:21

Collider configuration (shape, sensor, etc.).


enabled: boolean

Defined in: core/dist/index.d.ts:542

Whether this component is active. Disabled components are skipped by ComponentUpdateSystem.

Component.enabled


entity: Entity

Defined in: core/dist/index.d.ts:540

Back-reference to the owning entity. Set by the engine when the component is added to an entity. Do not set manually.

Component.entity

get context(): EngineContext

Defined in: core/dist/index.d.ts:554

Access the EngineContext from the entity’s scene. Throws if the entity is not in a scene.

EngineContext

Component.context


get scene(): Scene

Defined in: core/dist/index.d.ts:549

Access the entity’s scene. Throws if the entity is not in a scene. Prefer this over this.entity.scene! in component methods.

Scene

Component.scene

_dispatchCollision(event): void

Defined in: physics/src/ColliderComponent.ts:111

Internal

Called by PhysicsWorld during event dispatch.

CollisionEvent

void


_dispatchTrigger(event): void

Defined in: physics/src/ColliderComponent.ts:120

Internal

Called by PhysicsWorld during event dispatch.

TriggerEvent

void


_runCleanups(): void

Defined in: core/dist/index.d.ts:584

Internal

Run and clear all registered cleanups. Called by Entity.remove() and Entity._performDestroy() before onRemove/onDestroy.

void

Component._runCleanups


protected addCleanup(fn): void

Defined in: core/dist/index.d.ts:578

Register a cleanup function to run when this component is removed or destroyed.

() => void

void

Component.addCleanup


optional afterRestore(data, resolve): void

Defined in: core/dist/index.d.ts:598

Called after onAdd() during save/load restoration. Apply state that depends on onAdd() having run.

unknown

SnapshotResolver

void

Component.afterRestore


optional fixedUpdate(dt): void

Defined in: core/dist/index.d.ts:594

Called every fixed timestep by the built-in ComponentUpdateSystem.

number

void

Component.fixedUpdate


getOverlapping<T>(filter): Entity & T[]

Defined in: physics/src/ColliderComponent.ts:73

Return all entities whose colliders currently overlap this one, optionally filtered.

T

EntityFilter & object

Entity & T[]

getOverlapping(filter?): Entity[]

Defined in: physics/src/ColliderComponent.ts:74

Return all entities whose colliders currently overlap this one, optionally filtered.

EntityFilter

Entity[]


getOverlappingComponents<C>(cls): C[]

Defined in: physics/src/ColliderComponent.ts:81

Return components of type C from all overlapping entities that have one.

C extends Component

ComponentClass<C>

C[]


protected listen<T>(entity, token, handler): void

Defined in: core/dist/index.d.ts:574

Subscribe to events on any entity, auto-unsubscribe on removal.

T

Entity

EventToken<T>

(data) => void

void

Component.listen


protected listenScene<T>(token, handler): void

Defined in: core/dist/index.d.ts:576

Subscribe to scene-level bubbled events, auto-unsubscribe on removal.

T

EventToken<T>

(data, entity) => void

void

Component.listenScene


onAdd(): void

Defined in: physics/src/ColliderComponent.ts:36

Called when the component is added to an entity.

void

Component.onAdd


onCollision(handler): () => void

Defined in: physics/src/ColliderComponent.ts:55

Subscribe to collision events. Returns an unsubscribe function.

(e) => void

() => void


onDestroy(): void

Defined in: physics/src/ColliderComponent.ts:49

Called when the component is destroyed (entity destroyed or component removed).

void

Component.onDestroy


optional onRemove(): void

Defined in: core/dist/index.d.ts:588

Called when the component is removed from an entity.

void

Component.onRemove


onTrigger(handler): () => void

Defined in: physics/src/ColliderComponent.ts:64

Subscribe to trigger events (sensor). Returns an unsubscribe function.

(e) => void

() => void


serialize(): ColliderData

Defined in: physics/src/ColliderComponent.ts:99

Serialize the component into a plain data object.

ColliderData

Component.serialize


protected service<T>(key): T

Defined in: core/dist/index.d.ts:564

Lazy proxy-based service resolution. Can be used at field-declaration time:

readonly camera = this.service(CameraKey);

The actual resolution is deferred until first property access.

T extends object

ServiceKey<T>

T

Component.service


setSensor(sensor): void

Defined in: physics/src/ColliderComponent.ts:91

Set whether this collider is a sensor.

boolean

void


protected sibling<C>(cls): C

Defined in: core/dist/index.d.ts:572

Lazy proxy-based sibling component resolution. Can be used at field-declaration time:

readonly anim = this.sibling(AnimatedSpriteComponent);

The actual resolution is deferred until first property access.

C extends Component

ComponentClass<C>

C

Component.sibling


optional update(dt): void

Defined in: core/dist/index.d.ts:592

Called every frame by the built-in ComponentUpdateSystem.

number

void

Component.update


protected use<T>(key): T

Defined in: core/dist/index.d.ts:556

Resolve a service by key, cached after first lookup.

T

ServiceKey<T>

T

Component.use


static fromSnapshot(data): ColliderComponent

Defined in: physics/src/ColliderComponent.ts:104

Create a ColliderComponent from a serialized snapshot.

ColliderData

ColliderComponent