Per-particle expressions are a way to assign a value to each particle in the simulation using a program known as an expression. You can read all about particle expressions in the Maya documentation here:
Using particle expressions requires some amount of technical knowledge, however once you have mastered expressions, there is virtually no limit to the types of behaviours you can implement.
Using this powerful system, Particle Flocker allows you to create expressions which control a specific Particle Flocker attribute. This opens up a world of possibilities such as being able to create interesting procedural flock movements or being able to assign special behaviour to an individual flock member.
To create a per-particle expression you need to press the New Expression button in the Particle Flocker Window:
Pressing this button will display a pop-up menu with 3 options:
These are standard Maya particle expression types. You can read about them in the Maya documentation. However in a nutshell, they can be described as follows:
Creation Expression
Executed once at the start of a simulation and not updated again. Ideal if you want the expression to control the initial state of the particles
Runtime Before Dynamics Expression
Executed every frame before any dynamics calculations are performed. This type of expression is used if you want the expression to change during the simulation, such as ramping up a value over time.
Runtime After Dynamics Expression
Same as the before dynamics version, except that the expression is calculated after all dynamics is performed.
Example
Here is a simple example of a per-particle expression which modifies the Maximum Speed attribute over time, making particles appear to wait their turn before starting to move. This may be useful if you want to have birds taking flight one after another:
proc float getSpeed() { // Use the current particle's ID and the current frame // to decide if this particle should start to move or not if(frame > (nParticleShape1.particleId * 4)) return 10; return 0; } nParticleShape1.particleFlocker_maximumSpeed = getSpeed();
The above example expression must be set as a Runtime expression (Before or after dynamics).