QuadTree: store only points, or regions?
Posted
by
alekop
on Game Development
See other posts from Game Development
or by alekop
Published on 2012-06-22T22:52:30Z
Indexed on
2012/06/23
3:24 UTC
Read the original article
Hit count: 268
quadtree
I am developing a quadtree to keep track of moving objects for collision detection. Each object has a bounding shape, let's say they are all circles. (It's a 2D top-down game)
I am unsure whether to store only the position of each object, or the whole bounding shape.
If working with points, insertion and subdivision is easy, because objects will never span multiple nodes. On the other hand, a proximity query for an object may miss collisions, because it won't take the objects' dimensions into account. How to calculate the query region when you only have points?
If working with regions, how to handle an object that spans multiple nodes? Should it be inserted in the nearest parent node that completely contains it, even if this exceeds the node's capacity?
Thanks.
© Game Development or respective owner