How to use Unity and script to allow datasets and game objects to be picked up and moved around by the player in-game
Scripts required: OVR Grabbable Extended
GitHub link: https://github.com/Know-Thyself-as-a-Virtual-Reality/KTVR-DICOM-Tools
VIMEO link: https://vimeo.com/730609503/22e454b8b4
Step by step (initial setup):
- 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).
- Set up your scene with a dataset in Unity by following the tutorials for importing datasets and setting up the SelectionManager controls.
Step by step (attach component and script):
- Ensure the dataset(s) that you’d like to be able to grab are selected in the project hierarchy.
- Using the Add Component button under the inspector (fig. 1), search for and add a Rigidbody component and the OVR Grabbable Extended script.
- With your dataset(s) still selected, navigate to the Rigidbody component and ensure “Use Gravity” is unchecked and “is Kinematic” is checked (fig. 2).
Step by step (how to use):
- Click the Play button at the top of the window to activate.
- The datasets should now have the ability to be moved around in addition to the controls introduced with SelectionManager.
Fig. 1
Click Add Component and the search bar should appear
Fig. 2
Under Rigidbody, uncheck “Use Gravity” and check “Is Kinematic”
Note:
- Ensure the OVR Grabbable Extended script is applied, rather than the regular OVR Grabbable included with the Oculus Integration package
- The controls will not change from those applied with the SelectionManager, but now you’ll be able to relocate datasets using the right-hand index trigger