VIROO Interaction System
The VIROO Interaction System is the recommended way to provide user interactions (both in VR or keyboard and mouse), for the following reasons:
- It is a robust and well-tested system based on XR Interaction Toolkit.
- It allows cross-platform interactions: you will only have to add a single interaction component and with it you will obtain homologous functionalities for the different types of Input: keyboard and mouse, VR controllers, hand tracking, CAVE system wands.
- Network functionality: the actions and the interactions are executed through the VIROO Networking system, in the instances of all the users that have joined the platform, these interactions can launch VIROO Actions or other types of actions, such as, for example, changing a material.
How it works
flowchart LR
Interaction["A user performs an <span style=font-weight:bold>Interaction</span>"]
Interaction--- Network{{"Sent over <span style=font-weight:bold>Network</span> to all users"}}
Network--> Action["<span style=font-weight:bold>Action</span> performs in sync for every user"]
Action-.-> |Trigger| Events["Unity Events"]
Interactions
Interactions represent different types of Input that users can perform. There are the following types of Interactions in the Interaction System:
- Controller Button Interaction: with this interaction you can identify when a user presses a key on their controller (or keyboard, in the case of keyboard and mouse interaction).
- Grab Interaction: occurs when a user grabs an element of the scene.
- Ray Interaction: occurs, in VR, when a user points the ray coming out of the controller at an element and presses the Trigger button. In keyboard and mouse it is produced by clicking.
- Direct Interaction: it can be used to detect when one element has touched another (with Trigger colliders), useful for detecting that a user has touched an element with controllers or hands.
- Socket Interaction: is a component used for holding interactables via a socket. It allows the interaction of grasping and having to carry an object to the designated object position.
Actions
There are a variety of Actions provided by VIROO that serve to perform a variety of different behaviors within Unity. Actions are triggered as a result of the execution of an interaction. They are reproduced for all users of the session through the network.
With the Actions provided by VIROO you will be able to provide de following interactions:
- Activate and deactivate objects.
- Instantiate new objects
- Transform: there are actions to manipulate the transforms of your objects, move, rotate, scale....
- Play animations
- Play audio and video
- Change user avatars
Custom Actions
The versatility of these actions will provide you with the necessary tools to add interactivity to your VIROO Application. In cases where you need to cover a use case for which you don't have a suitable VIROO Action you can always create your own Actions by extending the VIROO logic.
Events
VIROO Actions also trigger Unity Events, usually indicating when the action has started or finished executing.
These events serve to extend the actions and add logic to them. You can use events to modify attributes of Unity components or even to call your own code.
Tip
Remember: Actions are executed across the network on all users in the session, so the events that they trigger are also called for all users.
There is also a specific action, UnityEventAction, which is useful for cases where you want to execute your own code as a result of an action, or use it to modify attributes of other Unity components or call other components methods.