Class Leap::HandModel

class Leap.HandModel : public Leap.HandModelBase

The base class for all hand models, both graphics and physics.

This class serves as the interface between the LeapProvider and the concrete hand object containing the graphics and physics of a hand.

The UpdateHand() function is called in the Unity Update() phase for graphics HandModel instances; and in the Unity FixedUpdate() phase for physics objects. InitHand() is called once, when the hand is created and is followed by a call to UpdateHand().

Public Functions

Vector3 GetPalmPosition ()

Calculates the position of the palm in global coordinates.

Return

A Vector3 containing the Unity coordinates of the palm position.

Quaternion GetPalmRotation ()

Calculates the rotation of the hand in global coordinates.

Return

A Quaternion representing the rotation of the hand.

Vector3 GetPalmDirection ()

Calculates the direction vector of the hand in global coordinates.

Return

A Vector3 representing the direction of the hand.

Vector3 GetPalmNormal ()

Calculates the normal vector projecting from the hand in global coordinates.

Return

A Vector3 representing the vector perpendicular to the palm.

Vector3 GetArmDirection ()

Calculates the direction vector of the forearm in global coordinates.

Return

A Vector3 representing the direction of the forearm (pointing from elbow to wrist).

Vector3 GetArmCenter ()

Calculates the center of the forearm in global coordinates.

Return

A Vector3 containing the Unity coordinates of the center of the forearm.

float GetArmLength ()

Returns the measured length of the forearm in meters.

float GetArmWidth ()

Returns the measured width of the forearm in meters.

Vector3 GetElbowPosition ()

Calculates the position of the elbow in global coordinates.

Return

A Vector3 containing the Unity coordinates of the elbow.

Vector3 GetWristPosition ()

Calculates the position of the wrist in global coordinates.

Return

A Vector3 containing the Unity coordinates of the wrist.

Quaternion GetArmRotation ()

Calculates the rotation of the forearm in global coordinates.

Return

A Quaternion representing the rotation of the arm.

virtual override Hand GetLeapHand ()

Returns the Leap Hand object represented by this HandModel. Note that any physical quantities and directions obtained from the Leap Hand object are relative to the Leap Motion coordinate system, which uses a right-handed axes and units of millimeters.

virtual override void SetLeapHand (Hand hand)

Assigns a Leap Hand object to this hand model.

virtual override void InitHand ()

Implement this function to initialise this hand after it is created. This function is called when a new hand is detected by the Leap Motion device.

int LeapID ()

Returns the ID associated with the hand in the Leap API. This ID is guaranteed to be unique among all hands in a frame, and is invariant for the lifetime of the hand model.

virtual abstract override void UpdateHand ()

Implement this function to update this hand once every game loop. Called once per frame when the LeapProvider calls the event OnUpdateFrame (graphics hand) or OnFixedFrame (physics hand)

Public Members

float handModelPalmWidth = 0.085f

The model width of the hand in meters. This value is used with the measured value of the user’s hand to scale the model proportionally.

FingerModel[] fingers = new FingerModel[NUM_FINGERS]

The array of finger objects for this hand. The array is ordered from thumb (element 0) to pinky (element 4).

Transform palm

Transform object for the palm object of this hand.

Transform forearm

Transform object for the forearm object of this hand.

Transform wristJoint

Transform object for the wrist joint of this hand.

Transform elbowJoint

Transform object for the elbow joint of this hand.

Properties

overrideChirality Handedness { get; set; }

The chirality or handedness of this hand (left or right).

abstractoverrideModelType HandModelType { get; set; }

The type of the Hand model (graphics or physics).

Public Static Attributes

static constint NUM_FINGERS = 5

The number of fingers on a hand.