Class Leap::FingerModel¶
- class Leap.FingerModel : public MonoBehaviour¶
The base class for all fingers.
This class serves as the interface between the HandController object, the parent Hand object and the concrete finger objects.
Subclasses of FingerModel must implement InitFinger() and UpdateFinger(). The InitHand() function is typically called by the parent HandModel InitHand() method; likewise, the UpdateFinger() function is typically called by the parent HandModel UpdateHand() function.
Public Functions
- void SetLeapHand (Hand hand)¶
Sets the Leap Hand and Leap Finger for this finger. Note that Leap Hand and Finger objects are recreated every frame. The parent HandModel object calls this function to set or update the underlying finger. The tracking data in the Leap objects are used to update the FingerModel.
- virtual void InitFinger ()¶
Implement this function to initialize this finger after it is created. Typically, this function is called by the parent HandModel object.
- virtual abstract void UpdateFinger ()¶
Implement this function to update this finger once per game loop. Typically, this function is called by the parent HandModel object’s UpdateHand() function, which is called in the Unity Update() phase for graphics hand models and in the FixedUpdate() phase for physics hand models.
- Ray GetRay ()¶
Returns a ray from the tip of the finger in the direction it is pointing.
- Vector3 GetBoneDirection (int bone_type)¶
Returns the direction the given bone is facing on the finger
- Quaternion GetBoneRotation (int bone_type)¶
Returns the rotation quaternion of the given bone
- float GetBoneLength (int bone_type)¶
Returns the length of the finger bone.
- float GetBoneWidth (int bone_type)¶
Returns the width of the finger bone.
- float GetFingerJointStretchMecanim (int joint_type)¶
Returns Mecanim stretch angle in the range (-180, +180] NOTE: Positive stretch opens the hand. For the thumb this moves it away from the palm.
- float GetFingerJointSpreadMecanim ()¶
Returns Mecanim spread angle, which only applies to joint_type = 0 NOTE: Positive spread is towards thumb for index and middle, but is in the opposite direction for the ring and pinky. For the thumb negative spread rotates the thumb in to the palm.
Public Members
- Transform[] bones = new Transform[NUM_BONES]¶
Bones positioned and rotated by FingerModel.
- Transform[] joints = new Transform[NUM_BONES - 1]¶
Joints positioned and rotated by FingerModel.