Dual Behaviors Handling

Several Behaviors require a Context Behavior to be active at the same time to be properly run.

This is the case when an Entity runs:

Basic synchronization

The easiest way to handle those pairs of behaviors is to use a Parallel Operator containing them: this will ensure that both behaviors are running at the same time (unless some specific Start/Stop Triggers are set, obviously).

For instance, if dealing with a Go To Behavior, this can be done by creating a Parallel operator then adding the Go To Behavior and a Navigation Behavior to it (or just by drag-and-dropping any of the Behaviors on the other one, as shown here).

A Navigation Behavior and a GoTo Behavior directly handled within a Parallel Operator

If others behaviors must be run after the GoTo Behavior, it is necessary to properly configure the Parallel Operator by setting its exit mode to "As soon as one behavior as ended" value; otherwise the Parallel Operator will remain active as the Navigation Behavior has not ended.

Continuous Synchronization

In general, several different Behaviors are performed successively, and the required Context Behavior must be running during the entire simulation time. A better way to handle this is to use a Parallel Operator containing:

  • The Context Behavior
  • A Behavior Container processing the other Behaviors 

Let's consider the case of driving an Entity to a target position, then back to its origin position. This can be done using a sequence of 2 GoTo Behavior (each configured with a different target) :

A sequence of Behaviors driving an Entity to a target point, then coming back to origin

Instead of putting each GoTo behavior in a Parallel Operator with a Navigation Behavior, let's only build a Parallel Operator containing a single Navigation Behavior (that will be use by all GoTo Behaviors used by the Entity) and a Behavior Container (that will contain the GoTo Behaviors sequence described above):

A Parallel Operator running in the same time only one Navigation Behavior with a Behavior Container handling all GoTo Behaviors

Also see Behavior Editor controls to know how to easily navigate in Behavior Containers hierarchy.