You can create conditions to control the logic flow. There are many nodes you can use and this page will cover the most commonly used ones.
Executing the Toggle will switch the node between ON and OFF states, executing the respective Output.
In this example, pressing the button executes the Toggle. When it's off, the cube is red, and when it's on, the cube is green.
Toggle starts in the Off state by default.
See Toggle for more information.
When you want control the Logic flow based on values, you can use the Compare and 2-to-4 Decoder nodes.
The Compare node takes two inputs (Value A and Value B) and then does a basic comparison operation for those inputs.
The True or False outputs will be executed based on the outcome of the comparison.
In this example, pressing the button increases the Number. When the number is greater than 5, the Comparison node executes its True output and the cube turns red.
See Compare for more information.
The 2-to-4 Decoder has four outputs and those get executed based on inputs A and B. The node expects boolean values, 0 for OFF and 1 for ON.
Based on the input values, the corresponding output will be executed.
In this example, pressing the left button turns the cube yellow, while pressing the right button turns it red. When pressing both, the cube turns pink.
See 2-To-4 Decoder for more information.
Finally, you can use Switch to change between multiple outputs.
You can define Output cases and the switch type by selecting the Switch node and tapping Edit
.
Switch node has three different modes:
Mode | Description |
---|---|
Integer Switch | Executes value based on the input integer Value. |
Decimal Range Switch | Executes Case based on in which range the input value lands. For example, 1.5 executes Case 1.0 … 2.0. |
Probability Distribution | Executes Output randomly based on probability. Higher value means higher chance to get executed. |
In this example, we are using a Probability Distribution Switch, which sets a "random" color to the cube when pressing the button. Note that it will never turn green, because it has a weight of 0.0.
See Switch for more information.