Tanoda
Leap.Unity.PinchDetector Class Reference

A basic utility class to aid in creating pinch based actions. Once linked with a HandModelBase, it can be used to detect pinch gestures that the hand makes. More...

Inheritance diagram for Leap.Unity.PinchDetector:
Leap.Unity.AbstractHoldDetector Leap.Unity.Detector

Public Attributes

float ActivateDistance = .03f
 
float DeactivateDistance = .04f
 
- Public Attributes inherited from Leap.Unity.AbstractHoldDetector
bool ControlsTransform = true
 
bool ShowGizmos = true
 
- Public Attributes inherited from Leap.Unity.Detector
UnityEvent OnActivate
 
UnityEvent OnDeactivate
 

Protected Member Functions

virtual void OnValidate ()
 
override void ensureUpToDate ()
 
- Protected Member Functions inherited from Leap.Unity.AbstractHoldDetector
abstract void ensureUpToDate ()
 
virtual void Awake ()
 
virtual void Update ()
 
virtual void changeState (bool shouldBeActive)
 

Protected Attributes

bool _isPinching = false
 
float _lastPinchTime = 0.0f
 
float _lastUnpinchTime = 0.0f
 
Vector3 _pinchPos
 
Quaternion _pinchRotation
 
- Protected Attributes inherited from Leap.Unity.AbstractHoldDetector
HandModelBase _handModel
 
int _lastUpdateFrame = -1
 
bool _didChange = false
 
Vector3 _position
 
Quaternion _rotation
 
Vector3 _direction = Vector3.forward
 
Vector3 _normal = Vector3.up
 
float _distance
 
float _lastHoldTime = 0.0f
 
float _lastReleaseTime = 0.0f
 
Vector3 _lastPosition = Vector3.zero
 
Quaternion _lastRotation = Quaternion.identity
 
Vector3 _lastDirection = Vector3.forward
 
Vector3 _lastNormal = Vector3.up
 
float _lastDistance = 1.0f
 
- Protected Attributes inherited from Leap.Unity.Detector
Color OnColor = Color.green
 
Color OffColor = Color.red
 
Color LimitColor = Color.blue
 
Color DirectionColor = Color.white
 
Color NormalColor = Color.gray
 

Static Protected Attributes

const float MM_TO_M = 0.001f
 

Properties

bool IsPinching [get]
 
bool DidStartPinch [get]
 
bool DidEndPinch [get]
 
- Properties inherited from Leap.Unity.AbstractHoldDetector
HandModelBase HandModel [get, set]
 
virtual bool IsHolding [get]
 Returns whether or not the dectector is currently detecting a pinch or grab. More...
 
virtual bool DidChangeFromLastFrame [get]
 Returns whether or not the value of IsPinching is different than the value reported during the previous frame. More...
 
virtual bool DidStartHold [get]
 Returns whether or not the value of IsHolding changed to true between this frame and the previous. More...
 
virtual bool DidRelease [get]
 Returns whether or not the value of IsHolding changed to false between this frame and the previous. More...
 
float LastHoldTime [get]
 Returns the value of Time.time during the most recent pinch event. More...
 
float LastReleaseTime [get]
 Returns the value of Time.time during the most recent unpinch event. More...
 
Vector3 Position [get]
 Returns the position value of the detected pinch or grab. If a pinch or grab is not currently being detected, returns the most recent position value. More...
 
Vector3 LastActivePosition [get]
 
Quaternion Rotation [get]
 Returns the rotation value of the detected pinch or grab. If a pinch or grab is not currently being detected, returns the most recent rotation value. More...
 
Quaternion LastActiveRotation [get]
 
Vector3 Direction [get]
 
Vector3 LastActiveDirection [get]
 
Vector3 Normal [get]
 
Vector3 LastActiveNormal [get]
 
float Distance [get]
 
float LastActiveDistance [get]
 
- Properties inherited from Leap.Unity.Detector
bool IsActive [get]
 

Additional Inherited Members

- Public Member Functions inherited from Leap.Unity.Detector
virtual void Activate ()
 
virtual void Deactivate ()
 

Detailed Description

A basic utility class to aid in creating pinch based actions. Once linked with a HandModelBase, it can be used to detect pinch gestures that the hand makes.

Definition at line 19 of file PinchDetector.cs.

Member Function Documentation

◆ ensureUpToDate()

override void Leap.Unity.PinchDetector.ensureUpToDate ( )
protectedvirtual

Implementations must implement this method.

Implements Leap.Unity.AbstractHoldDetector.

Definition at line 62 of file PinchDetector.cs.

◆ OnValidate()

virtual void Leap.Unity.PinchDetector.OnValidate ( )
protectedvirtual

Definition at line 46 of file PinchDetector.cs.

Member Data Documentation

◆ _isPinching

bool Leap.Unity.PinchDetector._isPinching = false
protected

Definition at line 38 of file PinchDetector.cs.

◆ _lastPinchTime

float Leap.Unity.PinchDetector._lastPinchTime = 0.0f
protected

Definition at line 40 of file PinchDetector.cs.

◆ _lastUnpinchTime

float Leap.Unity.PinchDetector._lastUnpinchTime = 0.0f
protected

Definition at line 41 of file PinchDetector.cs.

◆ _pinchPos

Vector3 Leap.Unity.PinchDetector._pinchPos
protected

Definition at line 43 of file PinchDetector.cs.

◆ _pinchRotation

Quaternion Leap.Unity.PinchDetector._pinchRotation
protected

Definition at line 44 of file PinchDetector.cs.

◆ ActivateDistance

float Leap.Unity.PinchDetector.ActivateDistance = .03f

Definition at line 27 of file PinchDetector.cs.

◆ DeactivateDistance

float Leap.Unity.PinchDetector.DeactivateDistance = .04f

Definition at line 32 of file PinchDetector.cs.

◆ MM_TO_M

const float Leap.Unity.PinchDetector.MM_TO_M = 0.001f
staticprotected

Definition at line 20 of file PinchDetector.cs.

Property Documentation

◆ DidEndPinch

bool Leap.Unity.PinchDetector.DidEndPinch
get

Definition at line 36 of file PinchDetector.cs.

◆ DidStartPinch

bool Leap.Unity.PinchDetector.DidStartPinch
get

Definition at line 35 of file PinchDetector.cs.

◆ IsPinching

bool Leap.Unity.PinchDetector.IsPinching
get

Definition at line 34 of file PinchDetector.cs.


The documentation for this class was generated from the following file: