What is the best way to perform collisions between a Quake map node and a mesh ?
1. For each frame, extract the triangles around the mesh and make a new geom/body
2. Create a big geom at the beginning with ALL triangles composing the Quake map and use that to perform the rest of the collisions
I hope someone already worked on that point. I'm looking for the best performance and I don't know if the collision library used in ODE already makes the extraction of the triangles in the neighbourhood as I described above. [/list]
[ODE] Fastest way to perform collisions in Quake map
All these triangle selectors look strange. I created a bounding box around my object and it is supposed to return all triangles which are inside the box (btw. what's "inside" in Irrlicht terminology ? all edges inside or a single corner ?).
Now, if I change the size of my bounding box, I always get the same triangles. Here's my code, I use an octree selector on a Quake map :
ExtractTrig returns 1394 faces. Ok, now with this code, a -much- smaller box, I still get 1394 faces ! Moreover, some faces aren't really related to the box.
What's wrong ? Did I miss something ?
Now, if I change the size of my bounding box, I always get the same triangles. Here's my code, I use an octree selector on a Quake map :
Code: Select all
#define MAX_TRIANGLES_SELECTOR 15000 // larger than triangles in Quake level
ITriangleSelector *s = getSceneManager()->createOctTreeTriangleSelector(m_mesh->getMesh(0), m_node);
m_node->setTriangleSelector(s);
s->drop();
... later ...
ITriangleSelector *s = m_node->getTriangleSelector();
s->getTriangles(m_triangles, MAX_TRIANGLES_SELECTOR, extractTrig, aabbox3d<f32>(-0.1,-0.1,-0.1,0.1,0.1,0.1));
Code: Select all
ITriangleSelector *s = m_node->getTriangleSelector();
s->getTriangles(m_triangles, MAX_TRIANGLES_SELECTOR, extractTrig, aabbox3d<f32>(-0.001,-0.001,-0.001,0.001,0.001,0.001));