Class Leap::Unity::FingerDirectionDetector

class Leap.Unity.FingerDirectionDetector : public Leap.Unity.Detector

Detects when specified fingers are pointing in the specified manner.

Directions can be specified relative to the global frame of reference, relative to the camera frame of reference, or using a combination of the two relative to the camera direction in the x-z plane, but not changing relative to the horizon.

You can alternatively specify a target game object.

If added to a HandModelBase instance or one of its children, this detector checks the finger direction at the interval specified by the Period variable. You can also specify which hand model to observe explicitly by setting handModel in the Unity editor or in code.

Since

4.1.2

Public Members

float Period = .1f

The interval at which to check finger state.

Since

4.1.2

HandModelBase HandModel = null

The HandModelBase instance to observe. Set automatically if not explicitly set in the editor.

Since

4.1.2

Finger.FingerType FingerName = Finger.FingerType.TYPE_INDEX

The finger to compare to the specified direction.

Since

4.1.2

PointingType PointingType = PointingType.RelativeToHorizon

Specifies how to interprete the direction specified by PointingDirection.

  • RelativeToCamera the target direction is defined relative to the camera’s forward vector, i.e. (0, 0, 1) is the cmaera’s local forward direction.

  • RelativeToHorizon the target direction is defined relative to the camera’s forward vector, except that it does not change with pitch.

  • RelativeToWorld the target direction is defined as a global direction that does not change with camera movement. For example, (0, 1, 0) is always world up, no matter which way the camera is pointing.

  • AtTarget a target object is used as the pointing direction (The specified PointingDirection is ignored).

In VR scenes, RelativeToHorizon with a direction of (0, 0, 1) for camera forward and RelativeToWorld with a direction of (0, 1, 0) for absolute up, are often the most useful settings.

Since

4.1.2

Vector3 PointingDirection = Vector3.forward

The target direction as interpreted by the PointingType setting. Ignored when Pointingtype is “AtTarget.”

Since

4.1.2

Transform TargetObject = null

The object to point at when the PointingType is “AtTarget.” Ignored otherwise.

float OnAngle = 15f

The turn-on angle. The detector activates when the specified finger points within this many degrees of the target direction.

Since

4.1.2

float OffAngle = 25f

The turn-off angle. The detector deactivates when the specified finger points more than this many degrees away from the target direction. The off angle must be larger than the on angle.

Since

4.1.2

bool ShowGizmos = true

Whether to draw the detector’s Gizmos for debugging. (Not every detector provides gizmos.)

Since

4.1.2