Jump To Locations
Setting Up Jump-to-Locations in SightLab
Table of Contents
Introduction
The jump-to-locations feature in SightLab allows users to quickly teleport to predefined locations in a virtual environment. This guide will walk you through the setup and use of this feature. Note that built into SightLab are also the moving transport and arc teleport. See the controls page for the buttons used by default for those methods.
Installation
Locate the following files in the ExampleScripts\Jump To Locations directory:
jump_to_locations_menu.py: Stores locations that can be jumped to with a virtual menu or keys 1-9
jump_to_locations_no_menu.py: Stores locations that can be jumped to with keys 1-9 without the virtual menu
VR_Menu_Locations.osgb: Required object for the virtual menu functionality
Choose your preferred implementation:
If you want to use the virtual menu: Copy jump_to_locations_menu.py and VR_Menu_Locations.osgb to your project directory.
If you don't need the virtual menu: Copy only jump_to_locations_no_menu.py to your project directory.
If you prefer to integrate the functionality into your existing script: Copy only the necessary code snippets and VR_Menu_Locations.osgb (if using the menu version).
Note: You don't need to copy both .py files, as they serve different purposes. Choose the one that best fits your needs.
Basic Setup
If integrating to your own script, add the following code:
# Import the jump_to_locations module
from sightlab_utils import jump_to_locations
# Add a tablet device
tablet = vizfx.addChild('VR_Menu_Locations.osgb')
sightlab.addSceneObject('tablet', tablet, grab=True)
# After sightlab.startTrial() or yield viztask.waitEvent(TRIAL_START), add:
locations_dir = os.path.join(os.path.dirname(__file__), 'locations')
jtl = jump_to_locations.JumpToLocations(tablet_item=tablet, locations_dir=locations_dir, config=sightlab.getConfig())
jtl.setup_transport_node()
jtl.tablet.visible(viz.ON)
vizact.onkeydown('/', jtl.save_position)
Saving Locations
Run your script.
Navigate to a desired location in your virtual environment.
Press the "/" key to save the location and take a screenshot.
Repeat for each location you want to save.
Note: In Desktop mode, use 'Q' and 'E' keys to rotate and save orientation, as mouse movement doesn't store rotation.
Configuring the Menu
Open the "VR_Menu_Locations.osgb" model in Inspector.
For each button image (e.g., "button1_image"): a. Select the button.
b. Double-click the texture on the right to open the texture selector. c. Click the folder icon to browse for your screenshots.
d. Navigate to your project's "recordings" folder and select the corresponding screenshot.
Repeat for each button, then save the object.
Using Jump-to-Locations
Virtual Menu: Use the right or left hand model to press screenshots and jump to locations.
Keyboard: Or use number keys (1-9) to jump to stored locations.
Menu Visibility: Press 'm' key or right thumbstick (controller) to reposition and toggle menu visibility (left trackpad for Vive controllers).
Menu Grabbing: Use either trigger button to grab the menu.
Session Replay
After a session you can view the Session Replay and data files to see which areas a user was interested in. See the Multi-User sections on how to run in Multi-User.
Advanced Configuration
Seated Mode: Add seated=True when initializing JumpToLocations.
Adding/Removing Locations: Edit the locations.txt file in the "locations" folder.
Multiple Environments/Trials: If you have envrionments that change per trial, then you will need to create a new copy of the VR_Menu_Locations.osgb object with another locations file. This can be placed in a new directory and will need to create a new instance of JumpToLocations referencing the other VR Menu object and locations directory.
More than 4 Buttons: Modify the VR_Menu_Locations.osgb file and update the JumpToLocations initialization:
jtl = jump_to_locations.JumpToLocations(tablet_item=tablet, locations_dir=locations_dir, config=sightlab.getConfig(), number_of_buttons=5)
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.
For more information on arc teleports see this page
For more information on transports in vizconnect see this page
Additionally, there is a "Jump To" functionality in vizconnect, see this page for more information on that.
Note that the "reset" feature in SightLab may cause issues with the locations being misaligned