Timeout condition

Updated on

December 9, 2022

In this VR Builder tutorial, you’ll learn how to use the timeout condition to create timed effects. The timeout condition waits for the defined time and then is automatically fulfilled. For example, a good use case is when you want to determine if the VR user meets certain conditions quickly enough. In addition, the timeout condition can be combined with other conditions to allow different paths depending on the speed of execution.

We will show you how to create such a scenario using a simple example: We check whether a box has been grabbed fast enough. In our case, the VR user must grab the green box within the first 10 seconds. If the VR user is too slow in doing so, they fail because the condition has not been fulfilled. Consequently, they will hear a voice telling them that they have failed. However, if the VR user succeeds, confetti will rain down from above.

  1. Setting up the scene in Unity
  2. Creating a delay with the Timeout Condition
  3. Next Steps

Setting up the scene in Unity

This Unity scene has an environment that contains a floor and a table. On the table there is also a green box. We used basic Unity boxes for simplicity but VR Builder works with any 3D models as well.

First, we set up the workflow for the following use case: If the VR user is quick enough in grabbing the box, they succeed. If they are too slow, they fail. Depending on which condition of the transition is met first, the corresponding path will be followed. The final workflow looks like this:

For additional help on setting up this workflow, refer to the tutorial on the VR Builder Process Editor. Also, the tutorial on creating consecutive steps and behaviors in Unity explains how to let the box move around the table.

In our example, the success criterion is to grab the green box. So we add a Grab object condition to the transition that leads to the success path and reference the green box. In case you are unfamiliar in making objects grabbable in VR, consult the tutorial on picking and placing objects in virtual reality.

Every time the VR user either succeeds or fails, they will hear a voice telling them so. We added a text-to-speech audio behavior for this. Learn more about verbal instructions in virtual reality in our tutorial on the VR Builder text-to-speech engine.

When the user is successful, they should receive a visual cue in addition to the verbal audio instructions to know that they have successfully completed the VR application. Our visual cue will be confetti rain. To implement confetti, select the Success step and go to Step Inspector > Behaviors > Add Behavior > Guidance > Spawn Confetti.

Creating a delay with the Timeout Condition

We are now creating the timeout condition. Select the step Are you quick enough in the Process Editor and press Add Condition in section Transition to Failure. Select Timeout under Utility.

Since we want the user in VR to have 10 seconds to perform the interaction, we set the Wait time to 10 seconds.

That's it. You are ready to run the application and see if your users are quick enough!

Next steps

In this VR Builder tutorial, you learned to measure whether the VR user is acting fast enough by implementing the timeout condition. What if you want to combine timed effects with a behavior sequence? Check out our tutorial on the delay behavior!

Helpful links

Download Vr Builder