private void CreateNewCopy() { GameObject handObject = LatestCopy; if (LatestCopy != null) { triggerColliderCount.SetInteractable(handObject); if (LatestCopy.GetComponent <Rigidbody>().isKinematic == true) { Destroy(LatestCopy); } } LatestCopy = Instantiate(CopyObject); LatestCopy.transform.position = transform.position; interactable = LatestCopy.GetComponent <Interactable>(); LatestCopy.SetActive(true); if (handObject != null) { CollisionIgnore.IgnoreCollisions(handObject.transform, LatestCopy.transform, true); StartCoroutine(CheckCollisionRelease(handObject, LatestCopy, interactable)); } lastPicked = handObject; }
private void Update() { if (interactable.State == InteractState.Grabbed && IsEnabled) { LatestCopy.GetComponent <Rigidbody>().isKinematic = false; CreateNewCopy(); } }