Skip to main content

Événements de physique

Evénements

ÉVÉNEMENT_DÉBUT_COLLISION

Emis lorsque l'entité a commencé à entrer en collision avec une autre entité.

Propriété

PropriétéTypeDescription
autreseidL'eid de l'entité qui entre en collision

Exemple

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

ÉVÉNEMENT DE FIN DE COLLISION

Emis lorsque l'entité a cessé d'entrer en collision avec une autre entité.

Propriétés

PropriétéTypeDescription
autreseidL'eid de l'entité qui entre en collision

Exemple

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

UPDATE_EVENT

Emis sur world.events.globalId immédiatement après la mise à jour de la physique avant le rendu.

Propriétés

Aucun.

Exemple

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