For collision detection, I am attempting to split up a large model into an octree.

If we take this black thing thing to be the ship (104,000 vertices):

enter image description here

Then I would like to split up the faces

enter image description here

I could easily split them up, but the problem is one of location. For example, if we take the bottom left chunk, how can I know that the projectile (in this case, a cannonball) is at that specific chunk?

And also how can I define the areas of the chunks in the first place? And for that matter, I need them to rotate with the ship as well!

I'm hopelessly lost as of how to do this, and so I'm hoping someone can help me out.

  • \$\begingroup\$ Did you search for Octree construction algorithm ? \$\endgroup\$
    – concept3d
    Mar 18, 2015 at 12:02
  • \$\begingroup\$ @concept3d I have, but I can't find any of them that do everything I need. \$\endgroup\$
    – joehot200
    Mar 18, 2015 at 12:37

1 Answer 1


first you transform the cannon ball into the coordinate space of the ship.

Then you act as if you want to add the ball's model to the octree and step down through the nodes. If the ball straddles a boundary line then go through both sides.

Once you get into a leaf not then there is the bucket with faces to test with.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .