In the previous sub-topic (the available actions), the conditions in actions were bypassed. In fact, every action can have a condition that controls whether the ActionManager executes the action or not. The conditions can check whether a value is one of the following states compared to another value:
- Equal
- Lesser
- Greater
- Different
There are three types of condition, as follows:
-
State condition: This checks whether the
.state
property ofBABYLON.Node
is equal to the given state. A state is a string. - Value condition: This checks whether a property is equal, lesser, greater, or different from a given value.
- Predicate condition: This calls a custom method that will return
true
orfalse
.
If an action has a condition, the action will be executed only if the condition returns true
.
Adding conditions to your actions graph shows all the power of the Actions Builder, which comes in the next topic. To understand the following example, before practicing with conditions...