Touch Interactions

The Telerik XR Interactions package provides functionality that allows you close distance finger interactions when using hand tracking in an XR application. This article describes the components that are needed to set up touch interactions.

ITouchSurface Interface

This interface is used to calculate the closest point and surface orientation when interacting with a touch surface. It is also used by the Touch Surface Volume Gesture which accumulates the touch surfaces that are in close range to the XR hand and provides them to the Finger Pointer to perform the necessary raycasting and events execution. You may implement this interface in objects that need to receive Unity Pointer events with finger interactions.

TouchSurfaceCanvas Class

This class implements the ITouchSurface interface allowing finger interactions with Canvas UI. TouchSurfaceCanvas must be attached to a Canvas element with RectTransform and BoxCollider components and is responsible for updating the collider when the RectTransform dimensions are changed. For easier setup you may drag and drop the Touch Surface Canvas prefab which is located in XR Core package Prefabs folder. This prefab has predefined structure with necessary colliders and components and you only need to adjust its RectTransform dimensions based on the touch surface size and position that you want to create in your scene.

Touch Surface Volume Gesture

This gesture is used as a PointerSource providing the closest ITouchSurface objects within a specified range. For more information, see the gestures documentation article.

Finger Pointer

The Finger Pointer prefab is responsible for sending the Unity Pointer events from the tracked finger to the closest ITouchSurface that is provided by the Touch Surface Volume Gesture. More information on this prefab is available in the finger pointer documentation article.

Pointers Controller

In case you have multiple pointers in your scene, you may consider using the PointersController class to manage the active state of the pointers based on their priority. This component must reference both the Finger Pointer instance and the Touch Surface Volume Gesture instances in order to activate the finger pointer only when there are available touch surfaces at a close distance. An example of this setup is available in the XR Interactions Rig prefab.

In this article
Not finding the help you need?