DIFF

class ParticleSource

ParticleSource Particle ParticleBase Entity ObjectTyped Object IEntity Managed

All members, including inherited

Legacy way of using particles in the game

NoteThey work okay when just needing to play a particle once every once in a while But are extremely wasteful when it comes to playing multiple Particles at the same time

Constructors 1

void Particle()

ctor

References ParticleInit()

Constants 1

static private const int MAX_EMITORS = 30

DEPRECATED

Members 17

protected int m_ParticleID

ID from ParticleList if assigned

protected float m_Lifetime

Approx. remaining lifetime of particle

protected bool m_IsRepeat

Whether this particle repeats

private bool m_MarkedForDeletion

Whether this particle is queued for deletion

Referenced by OnCheckAutoDelete()
bool m_WiggleProcessing

Used for Wiggle API, to signal that wiggle API is currently doing work

bool m_ForceOrientationRelativeToWorld

Used for Wiggle API, to restore after unparenting

vector m_DefaultWorldOri

Used for Wiggle API, to restore after unparenting

vector m_DefaultWorldPos

Used for Wiggle API, to restore after unparenting

float m_MaxOriWiggle

Used for Wiggle API, Wiggle room [-m_MaxOriWiggle, m_MaxOriWiggle]

float m_MaxOriInterval

Used for Wiggle API, Interval for wiggling [0, m_MaxOriInterval[

ref Timer m_RandomizeOri

Used for Wiggle API, calls the Wiggle functionality

protected Object m_ParentObject

Parent Object the Particle is child of

protected int m_PreviousFrame

DEPRECATED

private vector m_GlobalPosPreviousFrame

DEPRECATED

Methods 44

protected void ParticleInit()

Purely here so that it can be emptied in ParticleSource

Referenced by Particle()
static Particle CreateOnObject(int particle_id, Object parent_obj, vector local_pos = "0 0 0", vector local_ori = "0 0 0", bool force_world_rotation = false)

Creates a particle emitter and attaches it on the given object

particle_id
int Particle ID registered in ParticleList
parent_obj
Object Instance on which this particle will be attached
local_pos
vector Attachment position local to the parent (Optional)
local_ori
vector Orientation local to the parent (Pitch, Yawn, Roll in degrees) (Optional)
force_world_rotation
bool Forces particle's orientation to rotate relative to the world and not with the object (Optional)

Returns: Particle Created particle instance

Referenced by Create(), and PlayOnObject()
static Particle Create(int particle_id, Object parent_obj, vector local_pos = "0 0 0", vector local_ori = "0 0 0")

Legacy function for backwards compatibility

References CreateOnObject()
static Particle CreateInWorld(int particle_id, vector global_pos, vector global_ori = "0 0 0", bool force_world_rotation = false)

Creates a particle emitter on the given position

particle_id
int Particle ID registered in ParticleList
global_pos
Vector Position where the particel will be created
global_ori
vector Orientation (Pitch, Yawn, Roll in degrees) (Optional)
force_world_rotation
bool Forces particle's orientation to rotate relative to the world and not with the object (Optional)

Returns: Particle Created particle instance

static Particle Create(int particle_id, vector global_pos, vector global_ori = "0 0 0")

Legacy function for backwards compatibility with 1.01 and below

References CreateInWorld()
static Particle PlayOnObject(int particle_id, Object parent_obj, vector local_pos = "0 0 0", vector local_ori = "0 0 0", bool force_world_rotation = false)

Creates a particle emitter, attaches it on the given object and activates it

particle_id
int Particle ID registered in ParticleList
parent_obj
Object Instance on which this particle will be attached
local_pos
vector Attachment position local to the parent (Optional)
local_ori
vector Orientation local to the parent (Pitch, Yaw, Roll in degrees) (Optional)
force_world_rotation
bool Forces particle's orientation to rotate relative to the world and not with the object (Optional)

Returns: Particle Created particle instance

Referenced by Play()
static Particle Play(int particle_id, Object parent_obj, vector local_pos = "0 0 0", vector local_ori = "0 0 0")

Legacy function for backwards compatibility with 1.01 and below

References PlayOnObject()
static Particle PlayInWorld(int particle_id, vector global_pos)

Creates a particle emitter on the given position and activates it

particle_id
int Particle ID registered in ParticleList
global_pos
Vector Position where the particel will be created

Returns: Particle Created particle instance

Referenced by Play()
static Particle Play(int particle_id, vector global_pos)

Legacy function for backwards compatibility with 1.01 and below

References PlayInWorld()
override void PlayParticle(int particle_id = -1)

Method to tell the particle to start playing

particle_id
int Particle ID registered in ParticleList to start playing
References PlayParticleEx()
Referenced by Play(), PlayInWorld(), PlayOnObject()
Show 1 more, PMTPlayback.CheckStop()
override bool PlayParticleEx(int particle_id = -1, int flags = 0)

Method to tell the particle to start playing

particle_id
int Particle ID registered in ParticleList to start playing
flags
int Flags to pass to the playing (None on this level)

Returns: bool Whether the particle successfully started

NoteThe parameter to set the ID will only work when the particle is not already playing
Referenced by PlayParticle()
void Play(int particle_id = -1)

Legacy function for backwards compatibility with 1.01 and below

particle_id
int Particle ID registered in ParticleList to start playing
References PlayParticle()
override bool StopParticle(int flags = 0)

Method to tell the particle to stop playing

flags
int Flags to pass to the stopping (None on this level)

Returns: bool Whether the particle successfully stopped

NoteNo flags available for Particle
NoteEmitors are automatically removed later when its particle count is 0
Referenced by Stop()
void SetSource(int particle_id)

Sets particle id

particle_id
int Particle ID registered in ParticleList to start playing
NoteDoes not work at runtime, particle object needs to be destroyed and then Particle needs to play again
References m_ParticleID
int GetParticleID()

Gets particle id

Returns: int The last set Particle ID registered in ParticleList

NoteThis is not necessarily the CURRENT particle As one can use SetSource while the Particle is still playing But that will not change the particle before Particle is played again
References m_ParticleID
Object GetDirectParticleEffect()

Returns direct particle effect entity which is usually handled by this class 'Particle' if there is one

Returns: Object The Object with the particle component or null

NoteIs a child of this Particle
References m_ParticleEffect
Object GetParticleParent()

Returns the parent of this Particle if there is one

Returns: Object The registered parent or null

References m_ParentObject
bool HasActiveParticle()

Returns if there is any particle active

Returns: bool Whether there is any particle active

int GetParticleCount()

Returns the total count of active particles in all emitors

Returns: int Total count of active particles

NoteInternally does a sum, HasActiveParticle is better for a quick check
Referenced by OnCheckAutoDelete()
bool IsRepeat()

Returns whether there is a repeating particle

Returns: bool whether there is a repeating particle

float GetMaxLifetime()

Returns the approx. max lifetime

Returns: float The largest lifetime sum among the emitors

protected void UpdateState()

Creates/Destroys ParticleEffect child according to current state

NoteIs called from Play/Stop methods
Referenced by PlayParticleEx(), and StopParticle()
private void DestroyParticleEffect()

Destroys ParticleEffect child, called from UpdateState

NoteDoes not destroy it immediately As it simply nulls the lifetime Then it will be cleaned up by EOnFrame eventually
Referenced by UpdateState()
override void EOnFrame(IEntity other, float timeSlice)

OnFrame update event decrementing the stored approx. lifetime and checking for deletion

void OnCheckAutoDelete()

Creates ParticleEffect child, called from UpdateState

Referenced by EOnFrame()
private void OnToDelete()

Called before deletion from OnCheckAutoDelete

Referenced by OnCheckAutoDelete()
void AddAsChild(Object parent, vector local_pos = "0 0 0", vector local_ori = "0 0 0", bool force_rotation_to_world = false)

Attaches this particle onto some object. If null value is provided then the particle will be detached from the current parent.

parent
Object Parent onto which this particle will be attached
local_pos
vector Attachment position local to the parent (optional)
local_ori
vector Orientation local to the parent (Pitch, Yawn, Roll in degrees) (Optional)
force_rotation_to_world
bool Force rotation to be in WS (Optional)
NoteDue to the members being filled in, AddChild/RemoveChild cannot be used with Particle when using Wiggle
void SetParticleParam(int parameter_id, float value)

Set the value of a parameter of all emitors in the particle

parameter
int The parameter to apply the new value to (enum EmitorParam)
value
float The value to apply
void GetParameter(int emitter, int parameter, out float value)

Get the value of a parameter of an emitor in the particle

emitter
int The emitor to get the value from
parameter
int The parameter to get the value from (enum EmitorParam)
value
float The value
float GetParameterEx(int emitter, int parameter)

Get the value of a parameter of an emitor in the particle

emitter
int The emitor to get the value from
parameter
int The parameter to get the value from (enum EmitorParam)

Returns: float The value

void ScaleParticleParamFromOriginal(int parameter_id, float coef)

Scales the given parameter on all emitors relatively to their ORIGINAL value.

parameter_id
int The parameter to adjust (enum EmitorParam)
coef
float The multiplier to apply
void IncrementParticleParamFromOriginal(int parameter_id, float value)

Increments the value of the given parameter relatively from the ORIGINAL value.

parameter_id
int The parameter to adjust (enum EmitorParam)
value
float The value to sum
NoteIt's a simple sum, so negative value decrements
void IncrementParticleParam(int parameter_id, float value)

Increments the value of the given parameter relatively from the CURRENT value.

parameter_id
int The parameter to adjust (enum EmitorParam)
value
float The value to sum
NoteIt's a simple sum, so negative value decrements
bool IsWiggling()

Checks if particle is currently wiggling

void SetWiggle(float random_angle, float random_interval)

Makes the particle change direction by random_angle every random_interval seconds.

random_angle
float Will be the range [-random_angle, random_angle[ to wiggle between
random_interval
float Will be the time range [0, random_interval] to wiggle next time
NoteThis does not actually work on Particle with no parent, it should on ParticleSource
NoteCalling SetWiggle(0,0) will effectively stop all wiggle functionality
void StopWiggle()

Stops randomized wiggle

References Timer.Stop(), m_MaxOriInterval, m_MaxOriWiggle
Show 1 more, m_RandomizeOri
void RandomizeOrientation()

Randomizes a new orientation and applies it

protected vector RandWiggleVector()

Helper to get a randomized wiggle vector

References RandWiggleFloat(), and Vector()
protected float RandWiggleFloat()

Helper to get a randomized wiggle float value

Referenced by RandWiggleVector()