Updated on
April 26, 2024
In this VR Builder tutorial, you will learn what the restrictive environment in VR Builder is and how to customize it for your needs. This tutorial is structured in three parts:
The restrictive environment is a powerful feature of VR Builder that allows developers to limit the working environment of the VR user. Allowing only the referenced objects of the step to be interactable, in this way avoiding conflicts in the flow and clarity of the process.
But in some cases, a “sandbox scenario” where all the objects are interactable is preferred over a predefined process with limited interaction. To support this, VR Builder allows you to manage these "unlocked" objects and their interaction, as we will show in this tutorial.
In our demo application, the user will be able to assemble a little rocket in VR. At first, they will have to place the base of the rocket, then add the body, and finish with the top and a little window. In addition, all parts of the rocket should be able to be grabbed by the user and being moved around.
This Unity scene is composed of two tables, in one you will find pieces of a rocket that we prepared using Blender. In the second, the snapzones for the rocket pieces are already fixed for the final shape of the rocket. If you are not familiar with creating snapzones, we recommend you check the snapzones tutorial before continuing.
To start we need to define the order in which the rocket will be put together, create the steps and connect them. We will be starting by the bottom, but you may change the order.
To make a defined process, in each step we must create a transition, by clicking Add condition> Snap Object. In the object field, we will reference the object of the piece to be positioned in this step and the snapzone of the piece.
This process will be repeated for each piece, and by the end you should have a playable experience to build a rocket. But you will also find that, even if all the pieces have the grabbable component and are interactable in some step, you may not be able to grab them, for example the window in the step where you are supposed to place the body of the rocket.
This is due to the restrictive environment, objects are only made interactable when referenced in the step.
For this kind of development, it would be better if all the pieces that haven’t been placed were interactable during the rest of the experience. So let’s unlock them.
In the step inspector, there’s a third tab called Unlocked Objects. Here you can reference all the objects that you would like to make interactable while the step is active.
In the case of the “Snap base” step, try unlocking the “Body”, “Top” and “Window”, make sure to check the boxes for the TouchableProperty and GrabbableProperty.
Repeat the same process for the rest of the rocket pieces, remember to keep locked the ones that have been positioned already, so the VR user can’t move the correctly assembled pieces..
In this VR Builder tutorial you have learned, what the restrictive environment is, how it works, and how to customize it according to your needs. We have seen that it is possible to make objects available for interaction even if these objects are not referenced by behaviors or conditions in this step.
You can continue to improve this experience by customizing the snapzones look and feel, or interaction. If you have any further questions, please join the VR Builder community on discord and get in touch with VR Builder users and developers.