Example #1
0
        internal OrderedSet <CollisionBroadPhase> CollisionInspection(PhysicsObject col)
        {
            Debug.Log("Check " + this.name);
            OrderedSet <CollisionBroadPhase> set = new OrderedSet <CollisionBroadPhase>();

            if (!this.aabb.IsIntersects(col.DCollider))
            {
                Debug.Log("CollisionInpection Returns null");
                return(set);
            }
            if (!isLeaf)
            {
                foreach (QuadNode node in childNodes)
                {
                    set.Add(node.CollisionInspection(col));
                }
            }
            else
            {
                foreach (PhysicsObject obj in includedObjects)
                {
                    if (obj.id == col.id)
                    {
                        continue;
                    }
                    if (obj.DCollider.IsIntersects(col.DCollider))
                    {
                        CollisionBroadPhase tempCollision = new CollisionBroadPhase(col, obj);
                        set.Add(tempCollision);
                    }
                }
            }
            Debug.Log("CollisionInpection Returns : " + set);
            return(set);
        }
Example #2
0
 public void Add(OrderedSet<T> items)
 {
     foreach( T item in items)
     {
         if(item != null)
         this.Add(item);
     }
 }
Example #3
0
        internal OrderedSet <CollisionBroadPhase> GetAllCollisions()
        {
            OrderedSet <CollisionBroadPhase> set = new OrderedSet <CollisionBroadPhase>();

            Debug.Log("GetAllCollisions started");
            foreach (PhysicsObject obj in objectList)
            {
                Debug.Log("Get Collisions about " + obj);
                set.Add(rootNode.CollisionInspection(obj));
                Debug.Log("Collision Inspection completed about " + obj);
            }
            Debug.Log("GetAllCollisions ended");

            return(set);
        }