示例#1
0
 /// <summary> Returns all grabables that both fingers are touchign </summary>
 /// <param name="finger1"></param>
 /// <param name="finger2"></param>
 /// <returns></returns>
 public SG_Interactable[] GetMatching(int finger1, SG_HoverCollider touch)
 {
     if (touchScripts[finger1] != null && touch != null)
     {
         return(touchScripts[finger1].MatchingObjects(touch));
     }
     return(new SG_Interactable[] { });
 }
示例#2
0
 public void OnCollisionEnter(Collision collision)
 {
     //If we have a Physics layer, it's colliders, without RB, will pass on their OnCollisionEnter to this Object
     //If we have no Physics Layer, this function will not even trigger.
     if (ignoreGrabables)
     {
         SG_Interactable interactable;
         if (SG_HoverCollider.GetInteractableScript(collision.collider, out interactable))
         {
             this.physicsTrackingLayer.SetIgnoreCollision(collision.collider, true);
         }
     }
 }
示例#3
0
        /// <summary> Returns a list of interactables that are touched by both this hoverCollider and another hoverCollider </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public SG_Interactable[] MatchingObjects(SG_HoverCollider other)
        {
            List <SG_Interactable> bothTouch = new List <SG_Interactable>();

            SG_Interactable[] touchedOther = other.TouchedObjects;
            for (int i = 0; i < touchedOther.Length; i++)
            {
                if (this.IsTouching(touchedOther[i]))
                {
                    bothTouch.Add(touchedOther[i]);
                }
            }
            return(bothTouch.ToArray());
        }