|See what's going on with flipcode!|
Octrees For Collision Detection
Question submitted by (23 August 1999)
|Return to The Archives|
|Hi, recently you responded to a question about collision detection in an outdoor environment by suggesting the use of octrees. I was wondering what the best way to set up an octree is, i.e. how should the node class/structure be setup?|
There are lots of ways, many options and many combinations.
Sometimes it is preferable to build an octree where each node might have both, some polygons and some child nodes. Other times it is preferable to build an octree where a node has only children (node) or polygons (leaf) but not both.
When storing polygons in a node, what's the best way? There isn't one. It all depends on what you want to keep track of.
Then there is the question of what polygons get stored in a node (i.e. any polygon that intersects the three cutting planes of a node, or any polygon that intersects the node's volume, etc.)
These are all questions you must answer for yourself. Although I realize that I didn't supply you with an answer, I did supply you with something to think about so you can derive your own, customized answer.
Response provided by Paul Nettle
This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.