Skip to main content

Physics Events

Events

COLLISION_START_EVENT

Emitted when the entity has started colliding with another entity.

Properties

PropertyTypeDescription
othereidThe eid of the colliding entity

Example

defineState('initial-state').initial().listen(eid, ecs.physics.COLLISION_START_EVENT, (event) => {
console.log('Collided with', event.data.other)
})

COLLISION_END_EVENT

Emitted when the entity has stopped colliding with another entity.

Properties

PropertyTypeDescription
othereidThe eid of the colliding entity

Example

defineState('initial-state').initial().listen(eid, ecs.physics.COLLISION_END_EVENT, (event) => {
console.log('Stopped colliding with', event.data.other)
})

UPDATE_EVENT

Emitted on the world.events.globalId immediately after the physics update before rendering.

Properties

None.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.physics.UPDATE_EVENT, () => {
console.log('Physics update')
})