Quadtree to optimize collision detection