[ < ] [ Up ] [ > ]               [Top] [Contents] [Index] [ ? ]

3.2.6 Standard Particle Affectors

Ogre comes preconfigured with a few particle affectors. New ones can be added by creating plugins: see the Plugin_ParticleFX project as an example of how you would do this (this is where these affectors are implemented).

Linear Force Affector

This affector applies a force vector to all particles to modify their trajectory. Can be used for gravity, wind, or any other linear force. It's extra attributes are:

force_vector
Sets the vector for the force to be applied to every particle. The magnitude of this vector determines how strong the force is.
format: force_vector <x> <y> <z>
example: force_vector 50 0 -50
default: 0 -100 0 (a fair gravity effect)
force_application

Sets the way in which the force vector is applied to particle momentum.
format: force_application <add|average>
example: force_application average
default: add
The options are:

average
The resulting momentum is the average of the force vector and the particle's current motion. Is self-stabilising but the speed at which the particle changes direction is non-linear.
add
The resulting momentum is the particle's current motion plus the force vector. This is traditional force acceleration but can potentially result in unlimited velocity.

To create a linear force affector, include a section like this within your particle system script:
 
affector LinearForce
{
    // Settings go here
}
Please note that the name of the affector type ('LinearForce') is case-sensitive.

ColourFader Affector

This affector modifies the colour of particles in flight. It's extra attributes are:

red
Sets the adjustment to be made to the red component of the particle colour per second.
format: red <delta_value>
example: red -0.1
default: 0
green
Sets the adjustment to be made to the green component of the particle colour per second.
format: green <delta_value>
example: green -0.1
default: 0
blue
Sets the adjustment to be made to the blue component of the particle colour per second.
format: blue <delta_value>
example: blue -0.1
default: 0
alpha
Sets the adjustment to be made to the alpha component of the particle colour per second.
format: alpha <delta_value>
example: alpha -0.1
default: 0
To create a colour fader affector, include a section like this within your particle system script:
 
affector ColourFader
{
    // Settings go here
}

ColourFader2 Affector

This affector is similar to the ColourFader Affector, except it introduces two states of colour changes as opposed to just one. The second colour change state is activated once a specified amount of time remains in the particles life.

red1
Sets the adjustment to be made to the red component of the particle colour per second for the first state.
format: red <delta_value>
example: red -0.1
default: 0
green1
Sets the adjustment to be made to the green component of the particle colour per second for the first state.
format: green <delta_value>
example: green -0.1
default: 0
blue1
Sets the adjustment to be made to the blue component of the particle colour per second for the first state.
format: blue <delta_value>
example: blue -0.1
default: 0
alpha1
Sets the adjustment to be made to the alpha component of the particle colour per second for the first state.
format: alpha <delta_value>
example: alpha -0.1
default: 0
red2
Sets the adjustment to be made to the red component of the particle colour per second for the second state.
format: red <delta_value>
example: red -0.1
default: 0
green2
Sets the adjustment to be made to the green component of the particle colour per second for the second state.
format: green <delta_value>
example: green -0.1
default: 0
blue2
Sets the adjustment to be made to the blue component of the particle colour per second for the second state.
format: blue <delta_value>
example: blue -0.1
default: 0
alpha2
Sets the adjustment to be made to the alpha component of the particle colour per second for the second state.
format: alpha <delta_value>
example: alpha -0.1
default: 0
state_change
When a particle has this much time left to live, it will switch to state 2.
format: state_change <seconds>
example: state_change 2
default: 1
To create a ColourFader2 affector, include a section like this within your particle system script:
 
affector ColourFader2
{
    // Settings go here
}

Scaler Affector

This affector scales particles in flight. It's extra attributes are:

rate
The amount by which to scale the particles in both the x and y direction per second.
To create a scale affector, include a section like this within your particle system script:
 
affector Scaler
{
    // Settings go here
}

Rotator Affector

This affector rotates particles in flight. This is done by rotating the texture. It's extra attributes are:

rotation_speed_range_start
The start of a range of rotation speeds to be assigned to emitted particles.
format: rotation_speed_range_start <degrees_per_second>
example: rotation_speed_range_start 90
default: 0
rotation_speed_range_end
The end of a range of rotation speeds to be assigned to emitted particles.
format: rotation_speed_range_end <degrees_per_second>
example: rotation_speed_range_end 180
default: 0
rotation_range_start
The start of a range of rotation angles to be assigned to emitted particles.
format: rotation_range_start <degrees>
example: rotation_range_start 0
default: 0
rotation_range_end
The end of a range of rotation angles to be assigned to emitted particles.
format: rotation_range_end <degrees>
example: rotation_range_end 360
default: 0
To create a rotate affector, include a section like this within your particle system script:
 
affector Rotator
{
    // Settings go here
}

ColourInterpolator Affector

Similar to the ColourFader and ColourFader2 Affector?s, this affector modifies the colour of particles in flight, except it has a variable number of defined stages. It swaps the particle colour for several stages in the life of a particle and interpolates between them. It's extra attributes are:

time0
The point in time of stage 0.
format: time0 <0-1 based on lifetime>
example: time0 0
default: 1
colour0
The colour at stage 0.
format: colour0 <r> <g> <b> [<a>]
example: colour0 1 0 0 1
default: 0.5 0.5 0.5 0.0
time1
The point in time of stage 1.
format: time1 <0-1 based on lifetime>
example: time1 0.5
default: 1
colour1
The colour at stage 1.
format: colour1 <r> <g> <b> [<a>]
example: colour1 0 1 0 1
default: 0.5 0.5 0.5 0.0
time2
The point in time of stage 2.
format: time2 <0-1 based on lifetime>
example: time2 1
default: 1
colour2
The colour at stage 2.
format: colour2 <r> <g> <b> [<a>]
example: colour2 0 0 1 1
default: 0.5 0.5 0.5 0.0
[...]
The number of stages is variable. The maximal number of stages is 6; where time5 and colour5 are the last possible parameters. To create a colour interpolation affector, include a section like this within your particle system script:
 
affector ColourInterpolator
{
    // Settings go here
}

ColourImage Affector

This is another affector that modifies the colour of particles in flight, but instead of programmatically defining colours, the colours are taken from a specified image file. The range of colour values begins from the left side of the image and move to the right over the lifetime of the particle, therefore only the horizontal dimension of the image is used. Its extra attributes are:

image
The start of a range of rotation speed to be assigned to emitted particles.
format: image <image_name>
example: image rainbow.png
default: none
To create a ColourImage affector, include a section like this within your particle system script:
 
affector ColourImage
{
    // Settings go here
}


[ < ] [ Up ] [ > ]               [Top] [Contents] [Index] [ ? ]

This document was generated by Steve Streeting on , 12 2006 using texi2html