Using BSP or Octree for collision-purpose

mutle
Unregistered
 
Post: #1
Hi,
after my last thread ("Collision Detection with concave-Polygon"), I thought, that probably the best approach is to Triangulate the Complex Polygons.
Also I read, that many people use BSP-Tress for Collision Detection. I know about BSPs a bit, and I think they are hard to implement, so I was thinking if I can use Octree instead, which I like better Smile
Now I want to know if there is anything, why I shouldn't use Octrees?

(I would propably use a Quad-Tree, as I am doing a 2D-Game.)
--mutle
Quote this message in a reply
Feanor
Unregistered
 
Post: #2
I was waiting for OSC to post a follow-up to some noise I made about such things over in the 3D section, which is probably where this thread should be. (Transporting in 3, 2, 1...)
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #3
I believe the octree would not help you with actual collision detection, because it just breaks the world into bounding boxes.

It will reduce the number of object you have to consider for the CD.

The BSP breaks the polygons of the actual objects, and that's why you could use then for CD.

I did something similar to the octree in Mosquito Fighter.
Quote this message in a reply
Zoldar256
Unregistered
 
Post: #4
I used an Octree just fine for collision detection for a 3d mini-golf game.
My implementation worked like this:
Given the ball's current position and predicted path create a bounding box that enclosed this.
Query the octree for triangles that were within this box.
Check colision detection for all the returned triangles.

It general my scenes had 3000+ triangles and the query took very little time to return what was usually around 3 triangles.

You can optimize by not doign a full Octree search for repeat queries. For instance, if something was close to were it was on a previous query you can start your query from just one or two nodes up on the tree. Provides a nice speed boost compared to starting each search from the root.

Like NYGhost said: It still just reduces what you will need to consider. You'll still need to deal with checking collisions with whatever the base object is in your Octree.
Quote this message in a reply
Post Reply