Physics Events
Events
COLLISION_START_EVENT
Emitted when the entity has started colliding with another entity.
Properties
Property | Type | Description |
---|---|---|
other | eid | The eid of the colliding entity |
Example
- .listen
- .onEvent
- .addEventListener
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
Property | Type | Description |
---|---|---|
other | eid | The eid of the colliding entity |
Example
- .listen
- .onEvent
- .addEventListener
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
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.physics.UPDATE_EVENT, () => {
console.log('Physics update')
})