private void UpdatePinch() { bool pinchTriggered = false; bool releaseTriggered = false; float pinchStrength = 0; //Get grab position Vector3 thumbPos = leapManager.GetFingertipWorldPosition(0); Vector3 indexPos = leapManager.GetFingertipWorldPosition(1); grabPosition = thumbPos + (indexPos - thumbPos) / 2f; //Get pinch strength pinchStrength = leapManager.GetHandPinchStrength(); //if pinch strength is high enough if (pinchStrength >= pinchThreshold) { releaseCounter = 3; //Reset counter pinchTriggered = true; } else { if (releaseCounter > 0) { releaseCounter--; //Decrease counter } else { releaseTriggered = true; } } if (pinchTriggered && !pinching) { pinching = true; OnPinch(grabPosition); } if (releaseTriggered && pinching) { pinching = false; OnRelease(); } }