Exemplo n.º 1
0
    public void Insert(Body body)
    {
        if (!aABB.Contains(body.shape.aABB))
        {
            return;
        }

        if (bodies.Count < capacity)
        {
            bodies.Add(body);
        }
        else
        {
            if (!subDivided)
            {
                SubDivide();
            }
            northeast.Insert(body);
            northwest.Insert(body);
            southeast.Insert(body);
            southwest.Insert(body);
        }
    }
Exemplo n.º 2
0
 public override void Build(AABB aabb, List <Body> bodies)
 {
     potientialCollisionCount = 0;
     rootNode = new QuadTreeNodes(aabb, capacity);
     bodies.ForEach(body => rootNode.Insert(body));
 }