Particle Affectors

From Multiverse

Jump to: navigation, search

Contents

Summary

Particle affectors modify particles over their lifetimes, for example LinearForce affectors apply a force to all particles, and ColourFader affectors alter the color of particles in flight. Particle affectors have no common attributes; each affector has its own set of attributes.


Create an affector with a section like this in the particle system script:

affector type
{
   attribute value
   attribute value
   ...
}

Where type specifies the type of affector, is case-sensitive, and is one of:

  • ColourFader
  • ColourFader2
  • ColourImage
  • ColourInterpolator
  • LinearForce
  • Rotator
  • Scaler

Each attribute-value pair is listed on a separate line.

For example:

affector LinearForce
{
 force_vector 0 -1800 0
 force_application add
}

A particle script may use more than one affector.

Affector types

ColourFader

The ColourFader affector modifies the color of particles in flight.

Attribute Description Default Value Example
red delta_value Adjustment per second to the red component of particle color. 0 red -0.1
green delta_value Adjustment per second to the green component of particle color. 0 green -0.1
blue delta_value Adjustment per second to the blue component of particle color. 0 blue -0.1
alpha delta_value Adjustment per second to the alpha component of particle color. 0 alpha -0.1

ColourFader2

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

Attribute Description Default Value Example
red1 delta_value First state: adjustment per second to the red component of the particle color. 0 red1 -0.1
green1 delta_value First state: adjustment per second to the green component of particle color. 0 green1 -0.1
blue1 delta_value First state: adjustment per second to the blue component of particle color. 0 blue1 -0.1


alpha1 delta_value First state: adjustment per second to the alpha component of particle color. 0 alpha1 -0.1
red2 delta_value Second state: adjustment per second to the red component of particle color. 0 red2 -0.1
green2 delta_value Second state: adjustment per second to the green component of the particle color. 0 green2 -0.1
blue2 delta_value Second state: adjustment per second to the blue component of particle color. 0 blue2 -0.1
alpha2 delta_value Second state: adjustment per second to the alpha component of particle color. 0 alpha2 -0.1
state_change seconds When a particle has this much time left to live, it will switch to the second state. 1 state_change 2

ColourImage

The ColourImage affector modifies the color of particles in flight, but instead of programmatically defining colors, the colors are taken from a specified image file. The range of color values begins from the left side of the image and moves to the right over the lifetime of the particle, therefore only the horizontal dimension of the image is used.

Attribute Description Default Value Example
image image_name Image file to use. none image rainbow.png

ColourInterpolator

The ColourInterpolator affector is similar to the ColourFader2 affector. It modifies the color of particles in flight, but has a variable number of defined stages. It swaps the particle color for several stages in the life of a particle and interpolates between them.

Attribute Description Default Value Example
time0 0-1 based on lifetime Point in time of stage 0. time0 0 1
colour0 r g b [a] Color at stage 0. 0.5 0.5 0.5 0.0 colour0 1 0 0 1
time1 0-1 based on lifetime Point in time of stage 1. 1 time1 0.5
colour1 r g b [a] Color at stage 1. 0.5 0.5 0.5 0.0 colour1 0 1 0 1
time2 0-1 based on lifetime Point in time of stage 2. 1 time2 1
colour2 r g b [a] Color at stage 2. 0.5 0.5 0.5 0.0 colour2 0 0 1 1

The number of stages is variable. The maximum number of stages is six; so time5 and colour5 are the last possible parameters.

LinearForce

The LinearForce affector applies a force vector to all particles to modify their trajectories. Use it to simulate gravity, wind, or any other linear force.

Attribute Description Default Value Example
force_vector x y z Vector for the force to be applied to every particle. The magnitude of this vector determines how strong the force is. 0 -100 0 (a fair gravity effect) force_vector 50 0 -50
force_application type Way in which the force vector is applied to particle momentum. Valid types are:
  • average: The resulting momentum is the average of the force vector and the particle's current motion. This 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.
add force_application average


Rotator

The Rotator affector rotates particles in flight by rotating the texture.

Attribute Description Default Value Example
rotation_speed_range_start degrees_per_second Start of a range of rotation speed. 0 rotation_speed_range_start 90
rotation_speed_range_end degrees_per_second End of a range of rotation speed. 0 rotation_speed_range_end 180
rotation_range_start degrees Start of a range of rotation angles. 0 rotation_range_start 0
rotation_range_end degrees End of a range of rotation angles. 0 rotation_range_end 360

Scaler

The Scaler affector scales particles in flight.

Attribute Description Default Value Example
rate Amount to scale the particles in both the x and y directions. None rate 3
  • scaler does not seem to work


This document is based on the OGRE Manual and is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.

Personal tools