22 [Tooltip(
"The distance at which to enter the pinching state.")]
23 [Header(
"Distance Settings")]
26 [FormerlySerializedAs(
"_activatePinchDist")]
28 [Tooltip(
"The distance at which to leave the pinching state.")]
31 [FormerlySerializedAs(
"_deactivatePinchDist")]
56 private float GetPinchDistance(
Hand hand) {
57 var indexTipPosition = hand.GetIndex().TipPosition.ToVector3();
58 var thumbTipPosition = hand.GetThumb().TipPosition.ToVector3();
59 return Vector3.Distance(indexTipPosition, thumbTipPosition);
106 protected override void OnDrawGizmos () {
109 Vector3 centerPosition = Vector3.zero;
110 Quaternion circleRotation = Quaternion.identity;
112 centerColor =
Color.green;
120 centerColor =
Color.red;
122 circleRotation = hand.
Basis.CalculateRotation();
127 circleRotation.ToAngleAxis(out angle, out axis);
The Bone class represents a tracked bone.
BoneType
Enumerates the type of bones.
Vector NextJoint
The end of the bone, closest to the finger tip. In anatomical terms, this is the distal end of the bo...
The Finger class represents a tracked finger.
Bone Bone(Bone.BoneType boneIx)
The bone at a given bone index on this finger.
The Hand class reports the physical characteristics of a detected hand.
LeapTransform Basis
The transform of the hand.
List< Finger > Fingers
The list of Finger objects detected in this frame that are attached to this hand, given in order from...
virtual void changeState(bool shouldBeActive)
virtual bool IsHolding
Returns whether or not the dectector is currently detecting a pinch or grab.
Vector3 Position
Returns the position value of the detected pinch or grab. If a pinch or grab is not currently being d...
virtual bool DidStartHold
Returns whether or not the value of IsHolding changed to true between this frame and the previous.
Quaternion Rotation
Returns the rotation value of the detected pinch or grab. If a pinch or grab is not currently being d...
virtual bool DidRelease
Returns whether or not the value of IsHolding changed to false between this frame and the previous.
abstract Hand GetLeapHand()
A basic utility class to aid in creating pinch based actions. Once linked with a HandModelBase,...
virtual void OnValidate()
Quaternion _pinchRotation
override void ensureUpToDate()