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); } }
public override void Build(AABB aabb, List <Body> bodies) { potientialCollisionCount = 0; rootNode = new QuadTreeNodes(aabb, capacity); bodies.ForEach(body => rootNode.Insert(body)); }