
Let’s learn how to add interactions to XR.+ projects using the interactions module.
For this tutorial we’ll be using a simple 3D model file made of 3 objects (meshes): a sphere, a cube and a pyramid.
This tutorial will explain how to create states and buttons to hide and show those 3 objects.
You can download the Blender file and the fbx exported from Blender to make this tutorial by clicking here.
Create a new project in the studio, and start by importing the fbx file and adding it to the composition.
In the modules section, turn on the ‘advanced interactions’ module
For now there is only one state, the default one. This defaut state is applied as soon as the project is loaded and ready.
States actions are applied when a project switches into the corresponding state.
On this first state, we’ll only show the sphere and hide the cube and the pyramid, to do so, we need 2 actions.
The first action will show the sphere, the second one will hide the cube and the pyramid.
Let’s create another state, this new state will only show the cube. Again, we need 2 actions: one to show, another one to hide.
Then the the last state will show only the Pyramid, and like the other states, will hide the other 2 objects.
The 3 states now look like this, each with 2 actions:
Now that we have created our 3 states add added action to each of them, we need buttons to switch between those.
Create a first button to switch to the state 1.
We need 3 buttons: one for each state. The second button will switch to state 2, and the third button will switch to state 3.
And finally we need to add the buttons to each state so they can be visible during the experience, at the bottom of the screen.
We can add 3 actions to the first state to animates the objects. Choose ‘play basic animation’, select the mesh to animate and choose an animation.