private void HandlePossibleEndOfCustomInteractableHold() { if (currentlyHolding != null && !interactWithUI.GetState(pose.inputSource)) { currentlyHolding.OnRayEndClick(); // TODO: moving the object using the joint seems to break it for some reason, // for now a naive fix is to just re-instantiate the object while we finish moving it var copy = Instantiate(currentlyHolding.originalPrefab); var itemColliders = copy.GetComponents <Collider>(); if (itemColliders != null && itemColliders.Length > 0) { foreach (var itemCollider in itemColliders) { Destroy(itemCollider); } } copy.transform.position = currentlyHolding.transform.position; var customInteractable = copy.AddComponent <CustomInteractable>(); customInteractable.originalPrefab = currentlyHolding.originalPrefab; copy.AddComponent <MeshCollider>(); currentlyHolding.gameObject.SetActive(false); Destroy(currentlyHolding); currentlyHolding = null; copy.SetActive(true); //end naive fix } }
private void HandlePossibleHoveredCustomInteractableHold() { if (!currentlyHovered) { return; } if (currentlyHovered == currentlyHolding) { return; } if (interactWithUI.GetState(pose.inputSource)) { currentlyHolding = currentlyHovered; currentlyHolding.OnRayBeginClick(pointer.transform); } }
private void HandleEndOfCustomInteractableHover() { currentlyHovered.OnRayEndHover(); currentlyHovered = null; }
private void HandleCustomInteractableHover(CustomInteractable customInteractable) { currentlyHovered = customInteractable; customInteractable.OnRayHover(); }