Input Data Provider

Bones

An Input Data Provider (IDP) translates platform or device specific hand data into a 19 items array that Input module can work with: InputDataProvider.bones.

This array is read by Input module, which then will use to know how to transform master hand bones in the next frame.

The items of this array are AbstractTsf, a generic class that stores transformation values (position, rotation, scale and space) that can be then applied to any given Transform. Therefore, each item of this array stores the transformations to apply to each hand bone.

The mapping between each of this items and the actual BoneModels is done in InputModel.rigMap.

The position of each bone in the array matches the bone IDs in OVR excepting finger tips (bone IDs greater than 18). Here is a handy visual reference, thanks to u/GowerGames:

OVR hand tracking data was used as reference to homogenize hand data formats among platforms and devices. Once Unity officially offers an API layer for OpenXR, this array might change in the future to include also index, middle and ring metacarpal bones.

Confidence

IDPs also must update a normalized confidence value (from 0.0 to 1.0): InputDataProvider.confidence.

This value is used to detect tracking loss and trigger some Input module features like hand speed clamping or tracking noise smoothing.

Scale

Another value that an IDP must provide is hand scale: InputDataProvider.scale.

This value represents the real scale estimated by the device. Having a scale of 1.0 means that user's hand is exactly the same size as DefaultAvatar's hands at scale (1,1,1).

Some platforms offer this value but some others only offer the position of each bone in world space. IDPs for this second group will have to estimate this scale value. This can be done by comparing the length from wrist to middle finger tip in DefaultAvatar hands at scale (1,1,1) with the length from wrist to middle finger tip calculated from InputDataProvider.bones.

Examples

The following table shows some IDPs included in HPTK package:

Input source

Inspector

Description

Poses

(PoseSkeletonTracker)

Linearly interpolates between two poses. This interpolation can be animated in a loop. The position and rotation of the IDP determines the position and rotation of the wrist. Scale estimation can be changed manually.

OVR hand tracking

(OVRSkeletonTracker)

Translates hand data provided by OVRHand and OVRSkeleton.

UnityXR-compatible controllers

(UnityXRControllerTracker)

Linearly interpolates between 3 poses according to the input values provided by UnityXR. Device-specific offset is provided only for Oculus Touch but it can be extended to other devices by adding items to its list of compatible devices.

Last updated