Touch Interactions
The Telerik XR Core package provides a mechanism for handling close finger interactions through its ITouchSurface interface. This interface is used in the Telerik XR Interactions package to detect the components that interact with fingers when hand tracking is available.
ITouchSurface Interface
This interface is used to calculate the closest point and surface orientation when interacting with a touch surface. It is used to detect the surfaces that are available for touch interactions and to perform the needed calculations during the close distance interactions. You must implement the following methods:
-
ClosestPoint
—receives a point in space as an argument and returns the closest point from the touch surface. -
SurfaceDirection
—receives a point in space as an argument and returns the surface direction at the closest surface point.
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.
Touch Surface Canvas Prefab
For easier setup, you may drag and drop the Touch Surface Canvas
prefab which is located in the XR Core package Prefabs
folder. This prefab has a 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.