Combined Action

The Combined Action does not include any new VR behavior, it is a way to include multiple Actions in the same script. Combined Actions are useful in situations where we want to implement sequential tasks but incorporate them into a single entity.

In this example, we will convert the UseAction and the RemoveAction from the previous tutorials into a CombinedAction. As a result, in this Action the user would be asked to clean the Sponza with a cloth (UseAction) and then remove the jar using their hand (RemoveAction).

Action Blueprint

Create a new blueprint, and choose BPCombinedAction as its parent class:

../../../_images/combined_action_00.png

The graph below configures the combined action:

../../../_images/combined_action_01.png

Blueprint Walk-through

../../../_images/combined_action_02.png

By comparing this action blueprint with the blueprints from the UseAction and the RemoveAction tutorials, we can see that this blueprint contains all of the function calls from the aforementioned actions, as well as some extra calls to set-up the actions themselves, and to register them.

Note

The sub-actions will initialized sequentially; the Initialize event of the UseAction will be called first. When the user completes the action, the Initialize event of the RemoveAction will be called. After all the sub-actions have been completed, the Perform event of the combined action will be called as well.

../../../_images/combined_action_03.png

The method Insert IActions accepts an array of actions (actors that inherit from BasePrototype). Actions will be initialized in the order they appear inside the array. This function is mandatory for the CombinedAction to work properly.