3D Tablet/ VR Menu

Setting Up a VR Menu in SightLab

Introduction

The 3D Tablet Menu feature in SightLab allows users to use and modify a VR Menu to interact with your scene. This guide will walk you through the setup and use of this feature. Use either a selector/ highlighter tool or your controllers to interact with the menu.

Installation

Basic Setup

If integrating to your own script, add the following code:

# Import the vr_menu and selector modules

from sightlab_utils.vr_menu import VRMenu

from sightlab_utils import selector


#Add functions that will be called from the menu buttons

def Action1():

    print('button 1 pressed')


#Define which functions are called with the buttons

actions = [Action1, Action2, Action3, Action4]


vr_menu = VRMenu(actions,tablet_model = 'VR_Menu.osgb',config=sightlab.getConfig())

vr_menu_object = vr_menu.tablet

sightlab.addSceneObject('vr_menu_object', vr_menu_object, grab=True)


# After sightlab.startTrial() or yield viztask.waitEvent(TRIAL_START), add:

vr_menu.experiment_loop()

selector.setupSelector(sightlab.getConfig())

Using the VR Menu

For adding new buttons you will need to scale and move the Main-VR_Menu object in Inspector (using the scale and move tools) to make room, then use Shift and the move tools to make copies of the original button images and button(number)_target objects (the targets are what is used for the sensor). Making sure to place them in the same hierarchy in the tree as the others. 

Advanced Configuration

vr_menu = VRMenu(actions,tablet_model = 'VR_Menu.osgb',config=sightlab.getConfig(), number_of_buttons=5)