/// <summary> /// Release the grabbed object /// </summary> void ReleaseGrab() { _isGrabbing = false; StartAnimateClose(); if (_grabbedObject == null) { return; } _grabbedObject.Release(_handMover.Rigidbody.velocity); _grabbedObject = null; }
private void Update() { if (_grabbedObject != null) { if (_grabbedObject.gameObject == null) { _grabbedObject = null; return; } _grabbedObject.transform.position = transform.position; if (!MyGrabObject.Grabbed) { _grabbedObject.Release(Vector3.zero); _grabbedObject = null; _grabbedObject.gameObject.layer = GrabObject.GRABBEDLAYER; _grabbedObject.GetComponent <Collider>().enabled = true; } } }