Previous Document Next Document

Interaction > Creating reactions > Toggle Parameter reaction

Toggle Parameter reaction


This reaction toggles a parameter between two values.

For example, toggle the emission rate of particles between 0 and 100 to stop and start particle emission, or toggle a light on and off. In the following illustration, the duck is animated along two paths. A Toggle Parameter reaction is applied to the Active parameter of each path animation: when you press the red button, the duck jumps from one path to another.


You can apply this reaction to several parameters at once.

Note: The Toggle Parameter reaction is similar to the Set Parameter reaction except that Set Parameter sets a new value and stays that way, whereas Toggle Parameter lets you alternate between two values.

To create a Toggle Parameter reaction:
  1. In the World Explorer, select the parameter(s).
  2. Choose Interaction > Reactions > Toggle Parameter.
  3. In the Interaction Editor, a Toggle Parameter reaction appears for each selected parameter.

  4. Select a ToggleParam reaction.
  5. In the Parameter Editor, enter Start and Stop values.
  6. Each time the reaction is triggered, the parameter value toggles between the Start value and the Stop value.

Toggle Parameter Reaction Parameters

Start value

The value of the parameter the first time you trigger the reaction.

Stop value

The value after the next time you trigger the reaction.

Example: Turning a light on and off
  1. Select a light's Turned On parameter and choose Interaction > Reactions > Toggle Parameter.
  2. In the Interaction Editor, select the reaction.
  3. In the Parameter Editor, set the Start value to Yes and the Stop value to No.
  4. Expand the ArrowKeySensor and link OnKeyPress: Down to the new reaction.
  5. Switch to Browse mode to test the interaction. Press the Down arrow key to toggle the light on and off.

See also:

Linking Sensors and Reactions

Editing Triggers

Previous Document Next Document