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 '15 at 12:02
  • \$\begingroup\$ In my experience, we generally have 2 models, one graphics, and one for the collisions, which is made out of spheres and boxes and encompasses what's in the graphics model. The graphics and the physics models are always moved the same way at the same time; and you perform collisions based on that bunch of boxes/spheres. Maybe that will not work in your situation, though... \$\endgroup\$ – Vaillancourt Mar 18 '15 at 12:14
  • \$\begingroup\$ @AlexandreVaillancourt Unfortunately, I need PRECISE collision detection for my game. An approximation simply cannot suffice. Though I may be able to remove objects like sails in a collision model. \$\endgroup\$ – joehot200 Mar 18 '15 at 12:36
  • \$\begingroup\$ @concept3d I have, but I can't find any of them that do everything I need. \$\endgroup\$ – joehot200 Mar 18 '15 at 12:37

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.