Ejemplo n.º 1
0
 public void IntersectAABBs(AbstractCollider colliderA, List <AbstractCollider> candidates, List <AbstractCollider> containedBy, List <AbstractCollider> intersect, List <AbstractCollider> depenetrate)
 {
     foreach (AbstractCollider colliderB in candidates)
     {
         if (colliderA != colliderB && Collide.Intersects(colliderA.aabb, colliderB.aabb))
         {
             intersect?.Add(colliderB);
             containedBy?.Add(colliderB);
             depenetrate?.Add(colliderB);
         }
     }
 }
Ejemplo n.º 2
0
        public void FindDepenetrations(AbstractCollider collider, List<AbstractCollider> candidates, Dictionary<AbstractCollider, float2> lookup)
        {
            float2 total = float2.zero;

            foreach (AbstractCollider candidate in candidates)
            {
                float2 depenetration = Collide.Depenetrate(collider, candidate);
                lookup.Add(candidate, depenetration);
                total += depenetration;
            }

            depenetrations[collider] = total;
        }
Ejemplo n.º 3
0
        public void FindIntersections(AbstractCollider colliderA, List<AbstractCollider> candidates, HashSet<AbstractCollider> intersectionsA)
        {
            foreach (AbstractCollider colliderB in candidates)
            {
                ColliderPair pair = new ColliderPair(colliderA, colliderB);

                if (!checkedPairs.Contains(pair) && Collide.Intersects(colliderA, colliderB))
                {
                    checkedPairs.Add(pair);
                    intersectionsA.Add(colliderB);
                    intersections[colliderB].Add(colliderB);
                }
            }
        }
Ejemplo n.º 4
0
 public void FindContainedBy(AbstractCollider colliderA, List<AbstractCollider> candidates, HashSet<AbstractCollider> containedByA)
 {
     foreach (AbstractCollider colliderB in candidates)
         if (Collide.ContainedBy(colliderA, colliderB))
             containedByA.Add(colliderB);
 }