HandsInteractionTrainScene Sample Scene
Updated: Dec 9, 2024
Data Usage Disclaimer: Enabling support for Hand tracking grants your app access to certain user data, such as the user’s estimated hand size and hand pose data. This data is only permitted to be used for enabling hand tracking within your app and is expressly forbidden for any other purpose.
The Unity HandsInteractionTrainScene sample scene demonstrates how you can implement hand tracking to use hands to interact with objects in the physics system. In this sample, users can use their hands to interact with near or distant objects and perform actions that affect the scene.
The purpose of this topic is to introduce you to prefabs, game objects, assets, and scripts that are associated with this scene. You can also use this sample scene as a starting point for your own app.
Many of the interaction mechanisms used in this sample have been replaced by the Meta XR Interaction SDK.
This section walks through the key prefabs and other game objects that make the core hand tracking functionality in this scene work. These are all described in further detail later in this topic.
InteractableToolsSDKDriver prefab creates tools and allows them to interact with Interactable objects like the buttons, the windmills, and the crossing guards. Components attached to InteractableToolsSDKDriver are:
InteractableToolsCreator creates two tools, the ray and poke tools, which let you interact with near-field and far-field objects. InteractableToolsCreator has two properties:
- Left Hand Tools: a list of tools that should be added to the left hand
- Right Hand Tools: a list of tools that should be added to the right hand
You can add or take away prefabs from either Left or Right Hand Tools properties. This sample contains the following poke tools, which interact with near-field objects like buttons, and a ray tool, which interacts with far-field objects like windmills and crossing guards:
- FingerTipPokeToolIndex
- FingerTipPokeToolMiddle
- FingerTipPokeToolPinky
- FingerTipPokeToolRing
- RayTool
InteractableToolsInputRouter manages all tools in the scene, and covers cases where you should be using the poke tool instead of the ray tool.
This section provides an overview of the sample scene.
Both OVRHand components (found on the OVRHandPrefab under the hand anchors of the OVRCameraRig) must have the Pointer Pose Root correctly set to the TrackingSpace transform of the OVRCameraRig. Without this transform, the rays will shoot out of the side of the wrists.
Using Sample In Your Own App
To use prefabs in your own scenes, place the following prefabs into your scene:
- Assets/StarterSamples/Core/HandsInteraction/Prefabs/InteractableToolsSDKDriver.prefab
- Assets/StarterSamples/Usage/HandsTrainExample/Prefabs/NearFieldButton.prefab
- Assets/StarterSamples/Core/HandsInteraction/Prefabs/HandsManager.prefab and assign the Hands prefab to left and right variables.
Hand Tracking Sample Video
The hand tracking sample video demonstrates the use of hands in the HandsInteractionTrainScene scene.
Video: Hand tracking interaction with buttons that trigger actions in the train sample scene.