Grabbing Nearby Objects in MetaQuest


0. Contents of This Article
This article introduces how to grab and manipulate nearby 3D objects (cubes) with Meta Quest. This video is the AR version but supports both AR/VR.
You can also check the operation in the 02-NearManipulation or 02-NearManipulation-AR scene of the sample published on GitHub.
This article assumes that the preliminary preparations in the following article have been completed. Please note this.
[Preparation Edition]
Grabbing Objects in MetaQuest (Preparation)
1. Duplicating the Scene
While it's possible to edit the scene created in the previous article, to try manipulation without destroying the existing scene, I'll introduce how to duplicate the scene. Skip this if unnecessary.
- Open the Manipulation VR or AR scene created in previous articles
- Click File -> Save As... to save the current scene with a new name
This article uses *NearManipulation - Confirm that the scene name displayed in Hierarchy is NearManipulation
2. Settings for Grabbing Nearby Objects with Controllers or Hands
I'll introduce the scripts to add and their configuration methods for cases when using controllers or hands to grab objects. By configuring both, you can use both controllers and hands.
[Grabbing with Controllers]
- Display Cube's Inspector and click Add Component
- Search for Grab Interactable and select Grab Interactable from candidates
- Drag and drop Cube to Pointable Element in the added Grab Interactable
*Connects Grab Interactable and Grabbable, reflecting controller grab information to the behavior set in Grabbable (position, rotation, scale changes) - Further drag and drop Cube to Rigidbody in Grab Interactable
*By assigning the Rigidbody added to Cube in the previous article, contact detection between controller and Cube is utilized
[Grabbing with Hands]
- Display Cube's Inspector and click Add Component
- Search for Grab Interactable and select Hand Grab Interactable from candidates
- Drag and drop Cube to Pointable Element in the added Hand Grab Interactable
*Connects Hand Grab Interactable and Grabbable, reflecting hand grab information to the behavior set in Grabbable (position, rotation, scale changes) - Further drag and drop Cube to Rigidbody in Hand Grab Interactable
*By assigning the Rigidbody added to Cube in the previous article, contact detection between hand and Cube is utilized
[Note!]
If ControllerOnly is selected in Hand Tracking Support of OVR Manager attached to the OVRCameraRig object, hand tracking won't work and you won't be able to grab objects with hands. Please check the settings.
3. Fine-tuning Controller Settings (Optional)
The above operations enable grabbing and moving objects with controllers. By default, the grip button (middle finger) is used for grabbing. Here's how to enable grabbing with the trigger button as well.
- Open the OVRInteractionComprehensive child element of OVRCameraRig in the Hierarchy
- Further open child elements in this order: RightInteractions -> Interactors -> Controller and No Hand -> ControllerGrabInteractor
- Open the GripButtonSelector child element of ControllerGrabInteractor
- Pay attention to ControllerSelector in GripButtonSelector's Inspector
- Turn ON the TriggerButton checkbox in Controller Button Usage
*Turn off the GripButton checkbox if GripButton is not needed - Perform the same operation for the left hand controller (LeftInteractions) to set the button used for grabbing
4. Fine-tuning Hand Behavior (Optional)
This is a detailed point, but by default when scaling objects with both hands, the hand objects don't follow the actual hands. If you want the hand objects to follow, try the following.
- Select Cube in the Hierarchy
- Pay attention to Hand Grab Interactable registered to Cube in the Inspector
- Change Hand Alignment setting to None
6. Next Steps
You've now achieved grabbing and manipulating nearby objects. You can also combine near and far object manipulation for the same object.
If you want to add distant object manipulation, follow the procedures from chapter 2 of the next article.
Grabbing Distant Objects in MetaQuest
7. Complete List of Meta XR SDK Articles
Subscribe to my newsletter
Read articles from Takashi Yoshinaga directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
