PDF – Selecting and Manipulating Datasets in VR

How to use Unity and script to adjust the color and scale of grabbed objects while immersed in virtual reality

Scripts required: GenericLoader, SelectionManager, Selectable

GitHub link: https://github.com/Know-Thyself-as-a-Virtual-Reality/KTVR-DICOM-Tools

VIMEO link: https://vimeo.com/730608128/ba3362da5c

Step by step (initial setup): 

  1. If you don’t already have the Oculus Integration package installed, download it from the Oculus website (full instructions for this step can be found here).           
  2.  Set up your scene as desired, remember to include an object (full instructions  for importing DICOM data objects into unity can be found here). 

Step by step: 

  1. Use the right-click menu to create an empty GameObject. Rename it Selection  Manager. (This will make it so only one object can be selected at a time). 
  2. In the inspector under tags & layers, add a tag for SelectionManager. You can  make a new tag by clicking the + icon in the inspector (fig. 1). 
  3. With the SelectionManager game object selected in the hierarchy, assign the  SelectionManager tag by choosing it from the tag dropdown menu (fig. 2). 
  4. Open the OVRPlayerController in the hierarchy, then OVRCameraRig, and  select both hand anchors, which can be found in the TrackingSpace (fig. 3).
  5. With both hand anchors selected, give them a tag for hand in the inspector.
  6. Highlight the Selection Manager game object in the hierarchy, then click add  component in the inspector and add a Selection Manager script (fig. 4). 
  7. Next, select the object in the hierarchy that you want to be able to grab, click  add component and add a Selectable script.  
  8. You can now click the play button and use both controllers to manipulate object scale and color in-game.  

Fig. 1
Add a SelectionManager tag

 

Fig. 2
Assign the SelectionManager tag to the Selection Manager game object

Fig. 3
Find the left and right hand anchors in the OVRPlayerController and select both of them 

Fig. 4
You can find the selection manager script by typing in the add component search box

Note:

  • Ctrl D (PC) can be used to duplicate objects in Unity 
  • Using the right-hand controller, the index trigger can be used to select an object in-game. Then, A and B buttons can be used to toggle through color transforms, and the right joystick can be used to alter the volume scale
  • Objects will automatically deselect when a new one is selected