Hand Input Data Provider

  • Script that extends InputDataProvider with properties and functionalities that revolve more around hand tracking input sources

  • It is also abstract and, like with InputDataProvider, implementing behaviours should use its public and protected API to manipulate its state

Members defined by HandInputDataProvider are as follows:

Public properties

HandFingerStateCollection Fingers { get; }

  • A read-only collection that can be indexed into by zero-based integer (0 to 4) or a HandFinger enumeration. It contains 5 elements, each corresponds to a hand finger from thumb to pinky finger, in order. Each entry describes certain input related state of its corresponding finger. Items in this collection are of HandFingerState type which defines following properties:

    • IsPinching { get; }

      • Indicates whether the finger is in pinching gesture at the moment

    • PinchStrength { get; }

      • Value from [0, 1] range that quantifies the strength with which the finger is pinching currently, 0 being the weakest and 1 being the maximum pinch strength

    • Confidence { get; }

      • Similar to InputDataProvider's Confidence property, it quantifies the level of tracking confidence with which the input source is detecting the finger state at the moment. Limited to [0, 1] range

  • All of the values in this collection are false/zero as long as the inherited IsTracking property is false, i.e. IsPinching property is false and PinchStrength and Confidence properties are zero for every finger

  • This collection is exposed in the HandInputDataProvider's inspector panel and its elements can be modified there to provide the opportunity for observing the effect of changing them while in edit mode. The collection itself, however, is read-only - meaning elements cannot be added or removed from it, nor can they be reordered. Properties of its elements cannot be changed if the IsTracking property is false, to reflect its run-time behaviour

bool IsSystemGestureInProgress { get; }

  • This property indicates whether there is some system-defined gesture in progress. This depends on the underlying platform input source and what is considered to be system gesture is defined by that platform, or if it provides that functionality at all

  • This property is also always false if the input source is not tracked, i.e. if the IsTracking property is false

  • Editable in the inspector panel

UnityEvent OnSystemGestureStart { get; }

  • Event sent whenever a system-defined gesture has been detected, i.e. whenever the value of IsSystemGestureInProgress changes from false to true

  • Visible in the inspector and sent in edit mode as well

UnityEvent OnSystemGestureEnd { get; }

  • Event sent whenever a system-defined gesture has stopped, i.e. whenever the value of IsSystemGestureInProgress changes from true to false

  • Visible in the inspector and sent in edit mode as well

Protected methods

void SetFingerState(HandFinger finger, HandFingerState fingerState)

void SetFingerState(int index, HandFingerState fingerState)

  • Intended for behaviours that derive from HandInputDataProvider to call this to set the detected input state of the finger specified by the first parameter. It has no effect if IsTracking is false

void SetIsSystemGestureInProgress(bool isSystemGestureInProgress)

  • Sets the value of IsSystemGestureInProgress property. The relation between this method and IsSystemGestureInProgress property is equivalent to that of between InputDataProvider defined SetIsTracking method and IsTracking property - it handles the sending of the appropriate events depending on what value is being set and currently set value. Has no effect if IsTracking is false

Last updated