示例#1
0
 protected virtual void SetupCollider()
 {
     controlColliders     = VRTK_SharedMethods.ColliderExclude(GetComponentsInChildren <Collider>(), VRTK_SharedMethods.GetCollidersInGameObjects(excludeColliderCheckOn, true, true));
     createCustomCollider = false;
     if (controlColliders.Length == 0)
     {
         controlColliders = new Collider[1] {
             gameObject.AddComponent <BoxCollider>()
         };
         createCustomCollider = true;
         ConfigureColliders();
     }
 }
示例#2
0
        protected virtual void SetupInteractableObject()
        {
            createControlInteractableObject = false;
            controlInteractableObject       = GetComponent <VRTK_InteractableObject>();
            if (controlInteractableObject == null)
            {
                controlInteractableObject                  = gameObject.AddComponent <VRTK_InteractableObject>();
                createControlInteractableObject            = true;
                controlInteractableObject.isGrabbable      = true;
                controlInteractableObject.ignoredColliders = (onlyInteractWith.Length > 0 ? VRTK_SharedMethods.ColliderExclude(GetComponentsInChildren <Collider>(true), VRTK_SharedMethods.GetCollidersInGameObjects(onlyInteractWith, true, true)) : new Collider[0]);

                SetupGrabMechanic();
                SetupSecondaryAction();
                ManageInteractableObjectListeners(true);
            }
        }