   Collision with triangles making up level...how can I optimize?
  I am currently using an OcTree with all Game Objects for collision detection purposes.This is great until it comes to collision with the level itself.  If I have a level that is made up from lots of triangles then I need to know the triangles location in order to add it to a node in the OcTree.The problem is this:If the triangle is much bigger than an OcTree node, how can I spread it across many OcTree nodes?If I take the triangle Center (p1 + p2 + p3)/3 then that won't work.What do you experts suggest?   
  box tri intersect, although you may not be able to move the triangles in the map, the map would have to be static, because of computation.   ;Quote:Original post by Spa8nkyIf the triangle is much bigger than an OcTree node, how can I spread it across many OcTree nodes?another possibility is:you dont go deeper in the tree if a triangle is bigger than a node, but just keep it in that node, cause you'd have to put it in several nodes, which might result in doing several tests against it that could be done just once in a parent node.which version is faster is very dependant on the queries you do and the objects in your octree, in general, big queries (like visibility raycasts) are faster with keeping triangles in the smallest node that they fit in, tiny queries (like maybe player's Bounding-object) are faster if you sort the tri into all childs.;  Would it maybe be a good idea to split up larger triangles so that they fit into smaller nodes?I'm gonna do some more testing...   ;  You many want to consider not using an octree at all. That's what I do and it works well for my application. Sometimes a simple hierarchy with bounding spheres is better than an octree. It's simpler to implement and in my case it is better becuase I generate fractal terrain on the fly. It may not be the best option for you. It depends on a lot of factors but I just wanted to throw it out there.   ;  I like the idea of having a static terrain and using a triangle intersects bounding box method.  If the triangle intersects more than one box then just add it to that one.I'll post some code on here if I get it to work (or not).  I'm interested in seeing what you have to say about it.   ;Quote:Original post by Spa8nkyIf the triangle is much bigger than an OcTree node, how can I spread it across many OcTree nodes?It can't be. If it doesn't fit neatly in either child node, it's stored in the parent instead. At the root is one node representing the entire space. Everything fits within "the entire space" neatly, so you can put things there if all else fails. (Even a small object could be in the root node, if it happens to intersect the exact middle of the space.)That's why you're using a tree instead of just a grid that cuts up the space in each dimension. :)Edit: P. S. - we've been over this with someone else quite recently. :)   ;Quote:Original post by ZahlmanIt can't be. If it doesn't fit neatly in either child node, it's stored in the parent instead. At the root is one node representing the entire space. Everything fits within "the entire space" neatly, so you can put things there if all else fails. (Even a small object could be in the root node, if it happens to intersect the exact middle of the space.)This is the simple octree implementation. The problem with it is, for terrain  and similar things you tend to get get rows of polygons running along boundaries which starts to defeat the purpose of an octree.   