I'm trying to make a tree for spatial partitioning in my simple game.
I'm having trouble getting an idea of how I should make the tree, as the objects will be moving dynamically, and I want them to be grouped together based on their positions.
Now I know I could make a simple tree to hold them, but what about when they move. What would be a good way of transferring the objects based on their positions relative to others?
The best way I can think of is to make each tail-node into a sector, that holds all objects within a space, then when a object moves out of the sector of a node, I could move it up to the head node, then back down to the node that it would then belong to. However this proccess seems long and tedious, and is somewhat conflicting with the main purpose of the tree (to save time).
Does anyone have any suggestions?
Thank you for your time and effort,