PDF – Making Game Objects Grabbable in Unity

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): 

  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 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): 

  1. Ensure the dataset(s) that you’d like to be able to grab are selected in the project hierarchy. 
  2. Using the Add Component button under the inspector (fig. 1), search for and add a Rigidbody component and the OVR Grabbable Extended script.
  3. 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): 

  1. Click the Play button at the top of the window to activate.
  2. 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