# Determine wheter an octree node needs to be continue

For collision detection (moving vs. non-moving) in my current project, I decided to implement an octree approach after the preselection.

The only collision detection I'm currently using is a AABB-vs.-AABB collsion detection. Now, if this detection returns true for two objects (n, m), I want to subdivide the AABB into eight smaller axis-aligned boxes, and so on. (Octree)

Implementing the subdivision itself is now problem for me, but I'm stuck at the following: How can I determine whether a node needs to be divided further, or whether further subnodes are unnecessary?

Since I got objects of various complexity (a model with ca. 1500 vertices vs. a cube with 8), I can't simply check for the amount of vertices inside an octant.

What ways are there to determine whether a subdivision is necessard? Or am I even using a wrong approach any something else might work better?

Edit: I now think that an octree might be the wrong approach. What would be the best way to check for a more exact collision detection after an AABB collision detection returns true?

• Octrees, just like quadtrees, usually have some number of objects they hold per-node before they subdivide. I have an implementation here if you wanted to check it out. – fastinvsqrt Jul 31 '14 at 1:01
• Actually I now think an octree might be the wrong approach... DO you have a better idea? – s3lph Jul 31 '14 at 12:49
• Instead of AABB, you might want to look into OBB (oriented bounding boxes). It's more complex, but you could have an OBB per-part (arm, leg, etc) and that might give you the more exact collision detection you're looking for. – fastinvsqrt Jul 31 '14 at 15:28
• The problem is that I am generating the BBs during runtime (after loading the mesh's data from a PLY file). Generating an AABB isn't hard, but I can't get a per-part-OBB from these data (vertices, normals). For the player figure I could embed the OBBs in the config, but it's something else for various obstacles... – s3lph Jul 31 '14 at 22:27
• Are you going for mesh collision tests? – AturSams Oct 31 '14 at 20:26