Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

QuadTree's for Collision Detection

$
0
0
Hello D.I.C.

I'm here today to ask for a little guidance from those of you who have written a quadtree that was used for collision detection. As I was looking at my design today I realized that I need to change it up even more to get the functionality I desire, but I got to wondering what is a good way to tackle this problem. I'm not looking for code, just opinion here.

My idea is that I want two classes, QuadTree, and QuadTreeNode. The QuadTree class will handle all the creation of QuadTreeNodes and updating objects, checking collisions, and deciding which nodes need to be updated or not. QuadTreeNode should only keep track of what objects are currently inside of said node, and if the node has children or a parent. I wanted to make the tree divide a node when the maximum object limit is hit, but I got to wondering, lets say I divide a node into four, but objects are only in three of the new nodes. Should I delete that empty node, or leave it alone? I assumed that If I leave it, then the parent node would need to keep track of that single object since all the other objects should be moved to the children nodes, but I would like to hear from people more experienced than I. This is my first time attempting something so complex and any helpful tips/opinions are appreciated.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>