Class ParticleSystem
Particle system contains a composition of particle emitters and playback information.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Particles/ParticleSystem.h
Syntax
public class ParticleSystem : public BinaryAsset
Fields
DurationFrames
The animation duration (in frames).
Declaration
public int32 DurationFrames
Field Value
|
int32
|
Emitters
The emitters used by this system.
Declaration
public Array<AssetReference<ParticleEmitter>> Emitters
Field Value
|
Array<AssetReference<ParticleEmitter>>
|
EmittersParametersOverrides
The overriden values for the emitters parameters. Key is pair of emitter index and parameter ID, value is the custom value.
Declaration
public Dictionary<EmitterParameterOverrideKey, Variant> EmittersParametersOverrides
Field Value
|
Dictionary<EmitterParameterOverrideKey, Variant>
|
FramesPerSecond
The frames amount per second of the timeline animation.
Declaration
public float FramesPerSecond
Field Value
|
float
|
Tracks
The tracks on the system timeline.
Declaration
public Array<Track> Tracks
Field Value
|
Array<Track>
|
Version
The asset data version number. Used to sync the data with the instances state. Incremented each time asset gets loaded.
Declaration
public uint32 Version = 0
Field Value
|
uint32
|
Methods
getChunksToPreload()
Gets packed chunks indices to preload before asset loading action
Declaration
protected virtual AssetChunksFlag getChunksToPreload() const override
Returns
|
AssetChunksFlag
Chunks to load flags |
Overrides
GetDuration()
The animation duration (in seconds).
Declaration
public float GetDuration() const
Returns
|
float
|
GetReferences(Array<Guid>& assets, Array<String>& files)
Declaration
public void GetReferences(Array<Guid>& assets, Array<String>& files) const override
Parameters
|
Array<Guid>
assets
|
|
Array<String>
files
|
Init(ParticleEmitter* emitter, float duration, float fps=60.0f)
Initializes the particle system that plays a single particles emitter. This can be used only for virtual assets.
Declaration
public void Init(ParticleEmitter* emitter, float duration, float fps=60.0f)
Parameters
|
ParticleEmitter
emitter
The emitter to playback. |
|
float
duration
The timeline animation duration in seconds. |
|
float
fps
The amount of frames per second of the timeline animation. |
InitAsVirtual()
Initializes asset data as virtual asset.
Declaration
public virtual void InitAsVirtual() override
Overrides
load()
Load data from the chunks
Declaration
protected virtual LoadResult load() override
Returns
|
LoadResult
Loading result |
Overrides
LoadTimeline()
Loads the serialized timeline data.
Declaration
public BytesContainer LoadTimeline() const
Returns
|
BytesContainer
The output surface data, or empty if failed to load. |
Save(const StringView& path=StringView::Empty)
Saves this asset to the file. Supported only in Editor.
Declaration
public virtual bool Save(const StringView& path=StringView::Empty) override
Parameters
|
StringView
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
|
bool
True when cannot save data, otherwise false. |
Overrides
SaveTimeline(const BytesContainer& data)
Saves the serialized timeline data to the asset.
Declaration
public bool SaveTimeline(const BytesContainer& data) const
Parameters
|
BytesContainer
data
The timeline data container. |
Returns
|
bool
|
Spawn(Actor* parent, const Transform& transform, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(Actor* parent, const Transform& transform, bool autoDestroy=false)
Parameters
|
Actor
parent
The parent actor (can be null to link it to the first loaded scene). |
|
Transform
transform
The spawn transform. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
Spawn(Actor* parent, const Vector3& position, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(Actor* parent, const Vector3& position, bool autoDestroy=false)
Parameters
|
Actor
parent
The parent actor (can be null to link it to the first loaded scene). |
|
Vector3
position
The spawn position. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
Spawn(Actor* parent, Vector3 position, Quaternion rotation, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(Actor* parent, Vector3 position, Quaternion rotation, bool autoDestroy=false)
Parameters
|
Actor
parent
The parent actor (can be null to link it to the first loaded scene). |
|
Vector3
position
The spawn position. |
|
Quaternion
rotation
The spawn rotation. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
Spawn(const Transform& transform, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(const Transform& transform, bool autoDestroy=false)
Parameters
|
Transform
transform
The spawn transform. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
Spawn(const Vector3& position, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(const Vector3& position, bool autoDestroy=false)
Parameters
|
Vector3
position
The spawn position. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
Spawn(const Vector3& position, const Quaternion& rotation, bool autoDestroy=false)
Spawns the particles at the given location.
Declaration
public ParticleEffect* Spawn(const Vector3& position, const Quaternion& rotation, bool autoDestroy=false)
Parameters
|
Vector3
position
The spawn position. |
|
Quaternion
rotation
The spawn rotation. |
|
bool
autoDestroy
If set to |
Returns
|
ParticleEffect
The spawned effect. |
unload(bool isReloading)
Unloads asset data
Declaration
protected virtual void unload(bool isReloading) override
Parameters
|
bool
isReloading
True if asset is reloading data, otherwise false. |