[ODE] Fastest way to perform collisions in Quake map

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
bucheron
Posts: 7
Joined: Sun Apr 17, 2005 10:38 pm

[ODE] Fastest way to perform collisions in Quake map

Post by bucheron »

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]
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

If you managed to read the documentation on ODE, you'll note that you can build a trimesh in a Quad tree or Hash space to perform collision culling.
a screen cap is worth 0x100000 DWORDS
bucheron
Posts: 7
Joined: Sun Apr 17, 2005 10:38 pm

Post by bucheron »

Thanks for pointing this out. I am writing something using the octree selector but if performance is low, I will move to another method and give some hints here..
bucheron
Posts: 7
Joined: Sun Apr 17, 2005 10:38 pm

Post by bucheron »

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 :

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)); 
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.

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)); 
What's wrong ? Did I miss something ?
Post Reply