Grabbing Objects in MetaQuest (Preparation)


0. Contents of This Article
We begin introducing how to grab and manipulate 3D objects (cubes) with Meta Quest. While "grabbing objects" in VR or AR may sound simple, the required settings differ depending on whether the object is nearby or distant.
This series will introduce implementation methods for each case, but as a preparatory stage, this article explains settings commonly required for all cases. Completing this article will establish the foundation for object manipulation.
This video is the AR version but supports both AR/VR
The content of this article is preparatory, so manipulation like in the video cannot be performed with this content alone
This article assumes manipulation of cubes displayed in VR or AR scenes created in the following articles. Starting from cubes without special components added, in a state where they can only be viewed with Quest, you can achieve object manipulation by implementing the content of this article and subsequent articles if you have a similar situation in other projects.
[VR Version]
Displaying Objects in MetaQuest
[AR Version]
AR Display Using MetaQuest Passthrough
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 VR or AR scene created in previous articles
- Click File -> Save As... to save the current scene with a new name
This article uses *Manipulation - Confirm that the scene name displayed in Hierarchy is Manipulation
2. Enabling Object Contact Detection
To grab and manipulate objects, you need to detect contact between hands/controllers and objects. The procedure for object contact detection explained here is common to Unity development, not limited to Quest development.
[Checking Collider]
- Select the target object (Cube) in the Hierarchy
- Confirm that BoxCollider is applied in the Cube details displayed in the Inspector
For objects other than Cube, use Colliders appropriate for each object For custom models, manually add Colliders
[Adding and Configuring Rigidbody]
- Click the Add Component button at the bottom of the Inspector
- Enter Rigidbody in the search area
- Select Rigidbody from the displayed candidates
- Confirm that Rigidbody has been added to the Inspector and change it as follows:
Setting Item | Setting Value | Description |
Use Gravity | OFF | Disable gravity effects |
Is Kinematic | ON | Disable physics calculations |
Important: Collider and Rigidbody are necessary for contact detection, so be sure to set them on target objects.
3. Adding Grabbable and Movable Attributes
Here we add two types of attributes: making it grabbable and making it movable.
[Adding Grabbable Component]
- Select Cube in the Hierarchy
- Click Add Component, then search for Grabbable
- Select Grabbable from the candidates
[Adding Grab Free Transformer]
- Click Add Component in Cube's Inspector
- Search for Grab Free
- Select Grab Free Transformer from the candidates
Script that enables movement, rotation, and scale changes when grabbed by hands or controllers Can set constraints on movement and rotation through detailed configuration
*Other options like One Grab Rotate Transformer that restricts only rotation are also available - search with the Transformer keyword if interested
[Single-Hand Operation Setup]
- Open Options in Grabbable
- Drag and drop Cube to the right area of One Grab Transformer
*This operation registers the Grab Transformer added to Cube with the Grabbable script, completing preparation for moving objects with one hand
[Two-Hand Operation Setup]
Skip this if only single-hand operation is needed
- Open Options in Grabbable again
- Drag and drop Cube to the right area of Two Grab Transformer
*This operation registers the Grab Transformer added to Cube with the Grabbable script, completing preparation for moving objects with both hands - The Grabbable options should look like below if configured correctly
[Scale Change Settings (Optional)]
If you want to change object scale when operating with both hands, also perform the following settings.
- Pay attention to Grab Free Transformer in Cube's Inspector
- Open Scale Constraints
- Uncheck all X, Y, Z Axis Constraint checkboxes
4. Next Steps
You've now completed settings for changing the object's (Cube's) position, rotation, and scale when grabbed by controllers or hands.
However, you still can't manipulate the object. As explained at the beginning, this is because the required settings differ depending on the distance between objects and controllers/hands, and we haven't configured these yet. Additionally, we haven't set whether to use controllers, hands, or both for grabbing.
The next articles will introduce configuration methods for both near and far cases.
[Nearby Objects Edition]
Grabbing Nearby Objects in MetaQuest
[Distant Objects Edition]
Grabbing Distant Objects in MetaQuest
5. 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
