Ejemplo n.º 1
0
 //see in what child batch it should go
 public void Choose(_collider col)
 {
     for(int i = 0; i < 2; i++)
         for(int j = 0; j < 2; j++)
         {
             if (col.Minmax().Intersects(childs[i, j].cbound.Minmax()))
                 childs[i, j].Add(col);
         }
 }
Ejemplo n.º 2
0
 public void Add(_collider col)
 {
     if (col == null) return;
     cols.Add(col);
     AABB added = col.Minmax();
     AABB old = new AABB(minmax);
     //find outerbound to cut
     float minx = Math.Min(added.x, old.x);
     float miny = Math.Min(added.y, old.y);
     float maxx = Math.Max(added.x + added.w, old.x + old.w);
     float maxy = Math.Max(added.y + added.h, old.y + old.h);
     minmax.x = minx;
     minmax.y = miny;
     minmax.w = maxx - minx;
     minmax.h = maxy - miny;
     
     root.MakeBound(minmax);
     counter++;
 }