//Live Update function that allows dynamic checking if the Manus VR glove is in "pick-up" mode or rotate mode. private void Update() { is_grab = manus_inpt.get_hand(is_right).get_grabbing(); //check if rightmost hand, true if so. finger_array = manus_inpt.get_hand(is_right).get_raw_hand().ToArray(); int counter = 0; //While grabbing is determined directly from the Manus VR API, thumbs up has been implemented on the application side. //The following conditionals are used to determine if a Manus glove is thumbs-upping. //Check if more than 8 fingers are compressed for (int i = 0; i < 8; i++) { if (finger_array[i] > .85) { counter++; } } //Check if two are at least uncompressed. if (counter >= 7 && finger_array[8] < .3 && finger_array[9] < .3) { is_thumbs_up = true; interact.Rotate(); } else { is_thumbs_up = false; } //Grabbing conditional. if (is_grab) { //target_object.transform.position = distance_to_target + this.transform.position; interact.Pickup(); } else { interact.Drop(this.GetComponent <Rigidbody>()); } }
// Update is called once per frame void Update() { device_obj = SteamVR_Controller.Input((int)track_obj.index); //Conditionals for when the controller's trigger is pressed. if (device_obj.GetPress (SteamVR_Controller.ButtonMask.Trigger)) { device_obj.TriggerHapticPulse(100); interact.Pickup(); } //Trigger conditional if (device_obj.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) { interact.Drop(device_obj); } //If the grip on the controller is gripped, the gripper on the UR will close if (device_obj.GetPress(SteamVR_Controller.ButtonMask.Grip)) { if (gripper_ratio < 1.0f) { gripper_ratio += gripper_speed; } if (gripper_ratio >= 1.0f) { gripper_ratio = 1.0f; } // device_obj.TriggerHapticPulse(10000); device_obj.TriggerHapticPulse(100); } //IF the menu button is pressed, the gripper will attempt to open. if (device_obj.GetPress(SteamVR_Controller.ButtonMask.ApplicationMenu)) { release_gripper = !release_gripper; } //Release gripper conditional. if (release_gripper) { //If greater, attempt to "close" if (gripper_ratio > 0) { gripper_ratio -= gripper_speed; } //If shut, reset. if (gripper_ratio <= 0) { gripper_ratio = 0; device_obj.TriggerHapticPulse(10000); release_gripper = false; } } //Touchpad controls for rotating. if (device_obj.GetPress(SteamVR_Controller.ButtonMask.Touchpad)) { interact.Drop(device_obj); float tiltAroundX = device_obj.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).x; float tiltAroundY = device_obj.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).y; interact.Rotate(tiltAroundX, tiltAroundY); device_obj.TriggerHapticPulse(100); // Debug.Log("Bounce"); } if (device_obj.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad)) { interact.Drop(device_obj); } Vector2 trig_Val = device_obj.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); }