Original Post
Hey all, I've implemented a quadtree structure and am now looking to add some data (entities) for collision purposes. I have two questions that I haven't quite been able to find the answers to from reading various articles: 1 - Where do you store the objects? Do you store the object in the node that it fits entirely in? Or do you store it in EVERY node that it fits in? For example: Do I always add the object to the root, then see what other nodes it's touching, and add it there? 2 - What's an effective method of finding other objects? Let's say my HomingMissile object is looking for objects near it to smash into. What's a good way of getting all the objects around it? My guess is you define a box with the size you want to look in - then ask the quadtree for a list of objects from nodes that are touching that box. If you're right in the middle, then you're going to get a list of objects from every single node - I suppose that's one of the worst case scenario's however. Thanks for the clarification guys.