/// <summary> /// Try to release items /// </summary> private void UpdateReleaseObjects() { if (_grabbedItem == null || !HandData.ValidOutput(DeviceType)) { return; } if (_grabbedItem != null && _grabbedItem.Hand != this) { return; } // Release item when the hand is completely open if (HandData.HandOpened(DeviceType)) { Debug.Log("Released because the hand was fully open"); //ReleaseItem(); } //// ********************************* // Edited by Murray Sandmeyer // Before: if ( HandData.FirstJointAverage(DeviceType) < _averageOnGrab ) // This other option makes grabbing and releasing more consistent if (HandData.Average(DeviceType) < 0.2 && releaseEnabled) { ReleaseItem(); //Debug.Log("Release this item " + HandData.Average(DeviceType) + " - " + _averageOnGrab); } }
/// <summary> /// Try to release items /// </summary> private void UpdateReleaseObjects() { if (_grabbedItem == null) { return; } if (_grabbedItem != null && _grabbedItem.Hand != this) { return; } if (!_grabbedItem.IsDroppable) { return; } // Release item when the hand is completely open if (HandData.HandOpened(DeviceType)) { //Debug.Log("Released because the hand was fully open"); //ReleaseItem(); } if (HandData.FirstJointAverage(DeviceType) < _averageOnGrab) { ReleaseItem(); //Debug.Log("Release this item " + HandData.Average(DeviceType) + " - " + _averageOnGrab); } }
public override bool IsHandOpen(Hand handId) { #if VRTK_DEFINE_SDK_MANUS_VR return(handData.HandOpened(HandToDeviceType(handId))); #else return(false); #endif }
// Update is called once per frame void Update() { if (handData.HandClosed(deviceType)) { if (collidingObject) { GrabObject(); } } if (handData.HandOpened(deviceType)) { if (objectInHand) { ReleaseObject(); } } }