private void OnTriggerStay(Collider other) { if (!item && isGripping && other.GetComponent <Grabbable>()) { item = other.GetComponent <Grabbable>(); item.Grab(this); } }
private void OnTriggerStay(Collider other) { // check we are not already carrying an item, we are gripping, and we found a grabbable object if (!item && isGripping && other.GetComponent <Grabbable>()) { item = other.GetComponent <Grabbable>(); // start grabbing item.Grab(gameObject); } }
public void Grip() { isGripping = true; if (vrPointer.Target.transform.GetComponent <Grabbable>()) { item = vrPointer.Target.transform.GetComponent <Grabbable>(); item.Grab(grabPosition); item.transform.position = grabPosition.transform.position; } }