Emitter Component Events

The Emitter component events bus is used to get notifications in the engine for certain events happening to the PopcornFX emitter.

Bus events

Return type

Description

void

OnFxCreated(const AZ::EntityId &entityId) `Triggered when the effect attached to the entity has been created.
`entityId
is the identifier of the parent entity.

void

OnFxDisabled(const AZ::EntityId &entityId) `Triggered when the effect attached to the entity has been disabled.
`entityId
is the identifier of the parent entity.

Warning: This function is not completly implemented for now.

void

OnFxBroadcastEvent(const AZ::EntityId &entityId, SBroadcastParams *broadcastParams) `Triggered when an effect export an event to the game engine. `SBroadcastParams contains the exported event name.
In this callback, you can use the PopcornFXIntegrationBus::Handler::GetCurrentPayloadValue to retrieve the current event payloads (values transferred from the PopcornFX nodegraph to the engine).

Use in script canvas

You can also retrieve the events exported from a PopcornFX effect in the O3DE script canvas.
Here, in the PopcornFX editor, we create a simple particle layer that triggers an event on particle death. We specify the particle position as an input to the "OnDeath" event trigger node so that it is added as a payload:
image
In the root layer graph, we also output this event:
image
The event should appears in the "Effect Interface" panel:
image
We import this effect in O3DE, make sure it plays properly and add a "Script Canvas" component to the emitter entity:
image
image
Let’s create a new script canvas source file. We will use it to spawn the same effect at the location where each particle dies:
image
In this script canvas, we start by retrieving the event broadcasted from PopcornFX using the "PopcornFXBroadcast" node and then we use the "PopcornFXExtractPayload" node to get the "Position" payload from the particle graph.
We can then easily use this payload to spawn another effect at the location where the particles are dying:
image
When playing the game (CTRL+G in O3DE), we now have the same effect spawning at the locations where each one of the particle dies:
image
This is a very simple example of how to use this feature, but this can be used for gameplay interactions and many other purposes in your projects.