void OnTriggerStay(Collider other) { if (Hand.isGripDown() && other.tag == "Grabbable" && !other.gameObject.isStatic) { Debug.Log("Grip down, object is grabbable and not static"); if (_grabbingObject == null) { // begin grabbing the object _grabbingObject = other; _grabbingObjectOrigin = _grabbingObject.transform.parent; _grabbingObject.transform.SetParent(this.transform); Rigidbody _grabbingObjectRB = _grabbingObject.GetComponent <Rigidbody>(); _grabbingObjectRB.velocity = new Vector3(); _grabbingObjectRB.angularVelocity = new Vector3(); _distanceToGrabbingObject = Vector3.Distance(this.transform.position, _grabbingObject.transform.position); } } // if (Hand.isGripUp() && other.tag == "Grabbable") { // Debug.Log("[GRABCTRL] release:"); // Debug.Log(other); // ReleaseObject(); // } }
// Update is called once per frame void Update() { if (VRInput.isGripDown()) { // Reset Motion Debug.Log("Grip Down"); animator.SetBool("GripHand", true); } if (VRInput.isGripUp()) { // Reset Motion Debug.Log("Grip Up"); animator.SetBool("GripHand", false); } }