PopcornFX v2.14

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.14
  4. Plugins
  5. O3DE Gem
  6. Event Buses
  7. Emitter Component Requests

Emitter Component Requests

The Emitter component requests bus is used to interact with a PopcornFX emitter component.
The bus is connected using the entity ID corresponding to the entity on which the PopcornFX emitter is attached.

 

Warning: Be careful, those events need the effect to be loaded and instantiated before being used!
The effect async loading and creation is triggered by the SetupEmitterByName or SetupEmitterById events.
You can check if the emitter has been created by:

  • Making sure IsLoaded() returns true
  • Use the PopcornFX requests bus and calling IsEffectsPreloadingDone() that will only return true if all effects have finished loading
  • Connect to the emitter component events bus and waiting for the OnFxCreated() callback

 

Return typeDescription
voidEnable(bool enable)
Enables or disables the current emitter. When the emitter is disabled, the particles are neither simulated or rendered anymore.
boolStart()
Starts the particle emission on the current emitter.
Returns false if the effect is already started or still has some living particles.
boolStop()
Stops the particle emission on the current emitter. The particles that are still alive will continue getting the emitter instance transforms, so they will possibly continue following the emitter depending on how the effect was designed.
Returns false if the particle emission was already stopped.
boolTerminate()
Stops the particle emission on the current emitter. The particles that are still alive will not get the emitter transforms anymore, as if the effect was detached from the entity when this is called.
Returns false if the particle emission was already stopped.
boolKill()
Stops the particle emission on the current emitter and kills all the particles that were emitted from this emitter instance.
Returns false if the particle emission was already stopped and if all the emitted particles from this emitter are already dead.
boolRestart(bool killOnRestart)
Restarts the current effect.
If killOnRestart is false, the particle emission is stopped and the emitter is restarted when the last living particle dies.
If killOnRestart is true, the particle emission is stopped and all the living particles are killed. In this case the emitter is restarted immediately.
boolIsLoaded()
Returns true when the effect is loaded, false otherwise.
boolIsEnabled()
Returns true when the effect is enabled, false otherwise.
boolIsPlaying()
Returns true when the effect is currently playing or still has some living particles.
boolSetupEmitterById(const AZ::Data::AssetId &assetId, bool enable)
Setup the pkfx asset on this emitter component.
assetId is the identifier corresponding to the “.pkfx” effect asset.
enable enables or disables the current emitter.
Returns true if successful.
boolSetupEmitterByName(const AZStd::string &path, bool enable)
Setup the pkfx asset on this emitter component.
path is the path to the “.pkfx” effect asset.
enable enables or disables the current emitter.
Returns true if successful.
voidSetVisible(bool visible)
Hides or shows the current emitter particles. Unlike the Enable(bool enable) function, the simulation is still runing, the particles are just not rendered.
boolGetVisible()
Returns false if the emitter particles are hidden, true otherwise.
voidSetTimeScale(float timeScale)
Scales the simulation time for this emitter by the timeScale factor.
For example, if timeScale is 0.5f the effect will play twice as slow as normal.
floatGetTimeScale()
Returns the current time scale applied to this emitter component.
voidSetPrewarmEnable(bool enable)
Enables or disables the effect prewarm. Prewarming is used to start the effect at a certain point in time, so the effect looks like it has been simulated during a defined time when it is started.
boolGetPrewarmEnable()
Returns true if prewarm was enabled for this emitter.
voidSetPrewarmTime(float time)
Sets the prewarm time. If prewarm is enabled, the effect will look like it was simulated during time seconds as soon as it is started.
floatGetPrewarmTime()
Returns the prewarm time that was set for this emitter.
AZ::u32GetAttributesCount()
Returns the total number of attributes for this emitter. This does not include the samplers.
AZStd::stringGetAttributeName(AZ::u32 attribId)
Return the attribute name from its index attribId.
If attribId is invalid, returns an empty string.
AZ::s32GetAttributeType(AZ::u32 attribId)
Returns the attribute type from its index attribId.
The return value can be one of the following (see the EPopcornFXType enum in PopcornFXBus.h):
-1: Type_Unknown Invalid type
0: Type_Bool Boolean value
1: Type_Bool2 Vector2 boolean value
2: Type_Bool3 Vector3 boolean value
3: Type_Bool4 Vector4 boolean value
4: Type_Float Floating point value
5: Type_Float2 Vector2 floating point value
6: Type_Float3 Vector3 floating point value
7: Type_Float4 Vector4 floating point value
8: Type_Int Integer value
9: Type_Int2 Vector2 integer value
10: Type_Int3 Vector3 integer value
11: Type_Int4 Vector4 integer value
12: Type_Quaternion Quaternion orientation value
AZ::s32GetAttributeId(const AZStd::string &name)
Returns the index of the attribute based on the name parameter. If no attribute with this name exists, returns -1.
boolResetAttributeToDefault(AZ::u32 attribId)
Resets the attribute at index attribId to its default value.
Returns false if attribId is invalid.
boolSetAttributeAsFloat(AZ::u32 attribId, float value)
Sets a floating point attribute.
Returns false if attribId is invalid or if the attribute is not of type float.
boolSetAttributeAsFloat2(AZ::u32 attribId, const AZ::Vector2 &value)
Sets a vector2 float attribute.
Returns false if attribId is invalid or if the attribute is not of type float2.
boolSetAttributeAsFloat3(AZ::u32 attribId, const AZ::Vector3 &value)
Sets a vector3 float attribute.
Returns false if attribId is invalid or if the attribute is not of type float3.
boolSetAttributeAsFloat4(AZ::u32 attribId, const AZ::Vector4 &value)
Sets a vector4 float attribute.
Returns false if attribId is invalid or if the attribute is not of type float4.
boolSetAttributeAsInt(AZ::u32 attribId, AZ::s32 value)
Sets a integer attribute.
Returns false if attribId is invalid or if the attribute is not of type int.
boolSetAttributeAsInt2(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY)
Sets a vector2 integer attribute.
Returns false if attribId is invalid or if the attribute is not of type int2.
boolSetAttributeAsInt3(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ)
Sets a vector3 integer attribute.
Returns false if attribId is invalid or if the attribute is not of type int3.
boolSetAttributeAsInt4(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ, AZ::s32 valueW)
Sets a vector4 integer attribute.
Returns false if attribId is invalid or if the attribute is not of type int4.
boolSetAttributeAsBool(AZ::u32 attribId, bool value)
Sets a boolean attribute.
Returns false if attribId is invalid or if the attribute is not of type bool.
boolSetAttributeAsBool2(AZ::u32 attribId, bool valueX, bool valueY)
Sets a vector2 boolean attribute.
Returns false if attribId is invalid or if the attribute is not of type bool2.
boolSetAttributeAsBool3(AZ::u32 attribId, bool valueX, bool valueY, bool valueZ)
Sets a vector3 boolean attribute.
Returns false if attribId is invalid or if the attribute is not of type bool3.
boolSetAttributeAsBool4(AZ::u32 attribId, bool valueX, bool valueY, bool valueZ, bool valueW)
Sets a vector4 boolean attribute.
Returns false if attribId is invalid or if the attribute is not of type bool4.
boolSetAttributeAsQuaternion(AZ::u32 attribId, const AZ::Quaternion &value)
Sets a quaternion attribute.
Returns false if attribId is invalid or if the attribute is not of type quaternion.
boolSetAttributeAsColor(AZ::u32 attribId, const AZ::Color &value)
Sets a color attribute.
Returns false if attribId is invalid or if the attribute is not of type float3 or float4.
floatGetAttributeAsFloat(AZ::u32 attribId)
Returns the value of the attribute at index attribId or 0.0f if attribId is invalid.
AZ::Vector2GetAttributeAsFloat2(AZ::u32 attribId)
Returns the value of the attribute at index attribId or an uninitialized AZ::Vector2 if attribId is invalid.
AZ::Vector3GetAttributeAsFloat3(AZ::u32 attribId)
Returns the value of the attribute at index attribId or an uninitialized AZ::Vector3 if attribId is invalid.
AZ::Vector4GetAttributeAsFloat4(AZ::u32 attribId)
Returns the value of the attribute at index attribId or an uninitialized AZ::Vector4 if attribId is invalid.
AZ::s32GetAttributeXAsInt(AZ::u32 attribId)
Returns the value of the first attribute component at index attribId or -1 if attribId is invalid.
AZ::s32GetAttributeYAsInt(AZ::u32 attribId)
Returns the value of the second attribute component at index attribId or -1 if attribId is invalid.
AZ::s32GetAttributeZAsInt(AZ::u32 attribId)
Returns the value of the third attribute component at index attribId or -1 if attribId is invalid.
AZ::s32GetAttributeWAsInt(AZ::u32 attribId)
Returns the value of the fourth attribute component at index attribId or -1 if attribId is invalid.
boolGetAttributeXAsBool(AZ::u32 attribId)
Returns the value of the first attribute component at index attribId or false if attribId is invalid.
boolGetAttributeYAsBool(AZ::u32 attribId)
Returns the value of the second attribute component at index attribId or false if attribId is invalid.
boolGetAttributeZAsBool(AZ::u32 attribId)
Returns the value of the third attribute component at index attribId or false if attribId is invalid.
boolGetAttributeWAsBool(AZ::u32 attribId)
Returns the value of the fourth attribute component at index attribId or false if attribId is invalid.
AZ::QuaternionGetAttributeAsQuaternion(AZ::u32 attribId)
Returns the value of the attribute at index attribId or AZ::Quaternion::CreateIdentity() if attribId is invalid.
AZ::ColorGetAttributeAsColor(AZ::u32 attribId)
Returns the value of the attribute at index attribId or an uninitialized value if attribId is invalid.
AZ::u32GetAttributeSamplersCount()
Returns the total number of attribute samplers for this emitter.
AZ::s32GetAttributeSamplerId(const AZStd::string &name)
Returns the index of the attribute sampler based on the name parameter. If no attribute sampler with this name exists, returns -1.
boolSetAttributeSampler(AZ::u32 attribSamplerId, AZ::EntityId entityId)

Sets the attribute sampler at index attribSamplerId to the sampler component attached to the entity identified by entityId.
The effect needs to be stopped for this to work.
Returns false if attribSamplerId is invalid, if the effect is currently playing or if the sampler component attached to the target entity is not the same type as the emitter sampler.

boolResetSamplerToDefault(AZ::u32 attribSamplerId)
Resets the attribute at index attribSamplerIdto its default value.
Returns false if attribSamplerId is invalid.
AZ::EntityIdGetAttributeSampler(AZ::u32 attribSamplerId)
Returns the AZ::EntityId to which the attribute sampler at index attribSamplerId is attached to.
Returns AZ::EntityId::InvalidEntityId if attribSamplerId is invalid.
voidSetTeleportThisFrame()
Notify the emitter that the entity will be teleported to another place this frame.
This avoids spawning many particles when the emitter is using distance based particle emission.
Was this article helpful to you? Yes No

How can we help?