From PopcornFX
Jump to: navigation, search

CActionFactoryWithChilds - Main page : Particle layers Particle layers

This node is a particle "folder" that can contain multiple child layers.

CActionFactoryWithChilds Node properties

Field name Default value Description
CActionFactoryWithChilds Action
Delay 0 Delay in seconds before emission start.
RandomDelay 0 in the [0,1] range. Random coefficient to apply to the delay.

The final delay is computed as: Delay * (1 + rand(-1,1) * RandomDelay)
Basically, when 'RandomDelay' is 0.0, the real delay will be equal to 'Delay'.
When 'RandomDelay' is 1.0, the real delay will take a random value between '0' and 'Delay * 2'
When 'RandomDelay' is 0.5, the real delay will take a random value between 'Delay * 0.5' and 'Delay * 1.5'. etc...

Weight 1.0 When the layer is inside a folder that has a child evaluation mode set to 'random', tells the spawn probability of that layer. Higher values compared to other childs will mean that layer will have more chance to be spawned
CActionFactoryWithChilds General
RepeatCount 0 Number of times the folder should loop. 0 means run once only. 1 = loop once (run twice), 2 = loop twice (run 3 times), etc...
CActionFactoryWithChilds properties

CActionFactoryWithChilds Child evaluation mode

The way the folder runs the childs can be changed dynamically by clicking on the child evaluation icon:

CActionFactoryWithChilds child evaluation mode menu

There is a choice of three modes:

  • CActionFactoryWithChilds Run Parallel
  • CActionFactoryWithSequentialChilds Run Sequencial
  • CActionFactoryWithRandomChilds Random Pick

Each of these modes actually create internally a different node, but it is hidden by the interface. You can consider there is a single node, as it's what you'll see in the editor.

CActionFactoryWithChilds Run Parallel

All the childs will be launched simultaneously in parallel when the folder will be run.

File:CActionFactoryWithSequentialChilds Run Sequencial

Each child will be launched one after the other. The next child will only be run when the current child has finished executing.

For example, if we have 3 child layers lasting 2 seconds each, the folder will last 6 seconds.
The first child will be run immediately, the second child will be run after the first child has finished, that is, 2 seconds from the start, same for the third child, that will be run 4 seconds from the start.

CActionFactoryWithRandomChilds Random Pick

A single child in the child-list will be randomly picked and run.

The 'Weight' property of each child will be used to determine which child should be picked more often.
For example, considering the following child-list:

  • Child1, weight = 1.0
  • Child2, weight = 1.0
  • Child3, weight = 1.0

Each child will have the same probability to be picked, each will be picked with a chance of 1.0 / (1.0 + 1.0 + 1.0) = 33.3 %
However, if we have the following weights:

  • Child1, weight = 1.0
  • Child2, weight = 50.0
  • Child3, weight = 6.0

Child1 will have a 1.7 % chance of being picked. (1.0 / (1.0 + 50.0 + 6.0))
Child2 will have a 87.7 % chance of being picked. (50.0 / (1.0 + 50.0 + 6.0))
Child3 will have a 10.5 % chance of being picked. (6.0 / (1.0 + 50.0 + 6.0))

The following effect shows this:

Random folder setup Random folder result

The Layer_1 layer spawns Folder_1 when its particles collide with the world. Folder_1 is a random folder with 3 child layers.

at each spawn, the folder picks a random child layer to spawn.
the RED layer has a weight of 1.0
the GREEN layer has a weight of 50.0
the BLUE layer has a weight of 6.0

As we can see in the screenshot, there are more blue sparks than red ones, and much more green sparks than blue or red ones.