I\'m trying to use a quadtree for 2D collision detection, but I\'m a little stumped on how to implement it. First of all, I\'d have a quadtree which contains four subtrees (
I am not sure how cpu effective it is yet, but it seems to be working fine on my core duo in eclipse, still runs at over 2400 fps lol..
basically, I added one list to collidable objects to store references to quadtree node objects that I have associated the object with (via inserting into the quadtree). I also added a list to each quadtree node, that stores references to any objects deemed within the bounds of that node. So each node will only have one occurrence of each object. each node also stores a reference to its parent node, for navigation to nearby nodes if I want to check any of them after the inital node for further collision accuracy.
it's very easy to get references to all other objects in one cell:
list temp_checklist = object.cells[cell_index].objects
//('objects' being some sort of array or list of object references as described above)
hope that helps someone ;)