Beispiel #1
0
    private void OnTriggerStay(Collider collider)
    {
        if (touchedObject == null && IsObjectInteractable(collider.gameObject))
        {
            if (collider.gameObject.GetComponent <VRTK_InteractableObject>())
            {
                touchedObject = collider.gameObject;
            }
            else
            {
                touchedObject = collider.gameObject.GetComponentInParent <VRTK_InteractableObject>().gameObject;
            }

            OnControllerTouchInteractableObject(SetControllerInteractEvent(touchedObject));
            touchedObject.GetComponent <VRTK_InteractableObject>().ToggleHighlight(true, globalTouchHighlightColor);
            touchedObject.GetComponent <VRTK_InteractableObject>().StartTouching(this.gameObject);
            if (controllerActions.IsControllerVisible() && hideControllerOnTouch)
            {
                Invoke("HideController", hideControllerDelay);
            }
        }
    }