/// <summary> /// Try to grab items /// </summary> private void UpdateGrabObjects() { if (_grabbedItem != null || HandData.GetCloseValue(DeviceType) == CloseValue.Fist) { return; } // Always try to grab a item when the user is making a fist // ********* // Commented out by Murray Sandmeyer /* * if (HandData.FirstJointAverage(DeviceType) > 0.32f && _physicsHand.AmountOfCollidingObjects() > 0) * foreach (var rb in TriggerBinder.CollidingInteractables) * GrabItem(rb); * * if (_physicsHand.IsThumbColliding && _physicsHand.AmountOfCollidingObjects() > 1 && HandData.FirstJointAverage(DeviceType) > 0.07f) * foreach (var rb in TriggerBinder.CollidingInteractables) * GrabItem(rb); */ if (HandData.Average(DeviceType) >= 0.2) { foreach (var rb in TriggerBinder.CollidingInteractables) { GrabItem(rb); } } }
// Gets the correct manus average (either left or right hand) private float GetCorrectManusAverage() { if (GlobalControl.Instance.rightHanded) { return((float)handData.Average(device_type_t.GLOVE_RIGHT)); } else { return((float)handData.Average(device_type_t.GLOVE_LEFT)); } }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space)) { Debug.Log("Average Value Left" + handData.Average(device_type_t.GLOVE_LEFT).ToString()); Debug.Log("Average Knuckle Left" + handData.FirstJointAverage(device_type_t.GLOVE_LEFT).ToString()); } }