text
stringlengths 0
1.11k
|
|---|
Quest
|
The platform for which this article is written (Unity) does not match your preferred platform (Nativa).
|
Haz clic aquí para ver la página del índice de la documentación para tu plataforma de preferencia.
|
This tutorial describes the essential steps to:
|
Add OVRCameraRig to a Unity project.
|
Use OVRHand and OVRSkeleton prefabs in a project.
|
Check if the user is performing the pinch hand gesture.
|
Receive position and rotation data regarding a user’s hand bone (left hand’s index tip).
|
Draw a curve (Quadratic Bézier curve) as a LineRenderer.
|
Attach the curve to the user’s index tip to enable interaction with objects.
|
Apply physics capsule functionality to a hand for enabling collision detection with a GameObject.
|
App running
|
App running on a Meta Quest 2
|
This tutorial is a primary reference for working with hand tracking quickly by using the Meta XR All-in-One SDK. For complete documentation on hand tracking functionality, see Set Up Hand Tracking. For a complete library that adds controller and hand interactions to your apps, see Interaction SDK Overview.
|
Prerequisites
|
Before reading further, ensure you have followed all the steps in the Create Your First VR App on Meta Quest Headset tutorial. That tutorial helps you set up a Unity project that can build and run on a Meta Quest headset. You are going to build a small hand tracking app on top of that.
|
Hand tracking basics
|
Hand tracking analyzes discrete hand poses and tracks the position and rotation of certain key points on the user’s hands, such as wrist, knuckles, and fingertips. Integrated hands can perform object interactions by using simple hand gestures such as point, pinch, un-pinch, scroll, and palm pinch. To enable collision detection, hand tracking also provides functionality like physics capsules.
|
These are all available under the OVRHand, OVRSkeleton, and OVRBone classes which provide a unified input system for hand tracking under the umbrella of Meta XR Core SDK. For details, see OVRHand, OVRSkeleton, and OVRBone Class References.
|
Intuition and design considerations on pinching
|
Pinch is a simple but unique hand gesture because it provides a direct sense of tangibility. The user touches their thumb with their index finger in the real world, so they actually sense something while pinching. With the right set of interactions, this unique characteristic of pinch may help you target plausibility illusion, which is significant especially for MR experiences where the virtual world must blend into the physical world. This is the illusion that the scenario being depicted by your app is actually occurring.
|
In this app, a blue ribbon (LineRenderer) connects the user’s pinch point to the cube GameObject. There is no direct contact between the left hand and the cube. Only the right hand can collide with the cube.
|
Pinch gesture
|
Since the cube appears in the virtual world as a relatively small object when compared against the hands, the user may perceive it easier as “lightweight” and as something that does not cause much “drag” when being moved.
|
The thin ribbon detaches the cube object from the user’s direct pinch and offers a method of moving it from a distance. This purposefully pivots the interaction from a hand carrying the cube to a hand carrying a ribbon. Because the ribbon is perceived as a very lightweight object in the physical world, one that you can barely feel its weight when holding it, this interaction enables connecting to lightweight objects from a distance and even carrying them around. The curvy LineRenderer adds to the illusion of holding that lightweight ribbon more than, say, a metallic cylinder pipe would do as a picker.
|
Note: The tutorial uses Unity Editor version 2021.3.20f1 and Meta XR All-in-One SDK v59. Screenshots might differ if you are using other versions, but functionality is similar.
|
Step 1. Add OVRCameraRig to scene
|
If you haven’t already added OVRCameraRig to your project, follow these steps:
|
Meta XR Core SDK contains the OVRCameraRig prefab which is a replacement to Unity’s main camera. This means you can safely delete Unity’s main camera from the Hierarchy tab.
|
The primary benefit of using OVRCameraRig is that it offers the OVRManager component (OVRManager.cs script). OVRManager provides the main interface to the VR hardware.
|
Follow this process:
|
Under Hierarchy tab, right-click Main Camera, and select Delete.
|
In the Project tab, search for Camera Rig, and drag the OVRCameraRig prefab into your scene. Alternatively, drag it in the Hierarchy tab.
|
Add OVRCameraRig
|
Ensure your project’s hierarchy looks like this:
|
OVRCameraRig Hierarchy
|
Select OVRCameraRig in the Hierarchy tab.
|
With the OVRCameraRig selected in the Inspector, under the OVR Manager component, ensure your headset is selected under Target Devices.
|
OVRCameraRig Devices
|
Step 2. Set up scene to enable hand tracking
|
On the Hierarchy tab, select OVRCameraRig.
|
On the Inspector tab, go to OVR Manager > Quest Features.
|
In the Tracking section, select Eye Level for Tracking Origin Type.
|
Ensure Use Position Tracking is selected.
|
Tracking
|
In the Hand Tracking Support list, select Controllers and Hands or Hands Only (as you won’t use any controllers in this tutorial).
|
In the Hand Tracking Frequency list, select MAX or HIGH.
|
In the Hand Tracking Version, select V2.
|
Hand tracking support
|
Step 3. Add hand prefabs
|
On the Hierarchy tab, expand OVRCameraRig > TrackingSpace to add hand prefabs under the left and right hand anchors.
|
Hierarchy 1
|
On the Project tab, search for the OVRHand Prefab.
|
Drag a copy of the OVRHand Prefab into the Assets folder.
|
OVR Hand Prefab
|
Drag the prefab from the Assets folder on each hand anchor on the Hierarchy tab. Do this twice, once per hand.
|
Hierarchy 2
|
On the Hierarchy tab, under RightHandAnchor, select OVRHandPrefab, and then on the Inspector tab, change its name to OVRHandPrefabRight.
|
Under the OVR Hand, OVR Skeleton, and OVR Mesh components, change the hand type to Hand Right.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.