Skip to main content
gamedev.net
🔒 Locked

Collision detection

Started by ChristophR Oct 15, 2005 at 10:25 AM 2 replies 550+ views
Original Post
ChristophR
ChristophR
Hi! I want to check if 2 3d models intersect. My first idea was to check for all triangles of model 1 if they intersect with one of the triangles of model 2. But that has the effect that I have to do very many tests which makes the whole method very slow (espcially if I have models with thousands of triangles). I don't think that I can optimize my triangle_triangle_intersect method very much. Therefore I should use another strategy which reduces the triangles I have to check. Of course I use a bounding box/sphere collision first, which exclude models from the triangle-check which are too far away from each other. But that still does not solve the problem that my frames per second are very slow if the bounding boxes intersect but the models itself not. In some situations, the bounding box collision is enough, but sometimes I need a method which does an exact collision detection. Are there any ideas how I could improve my algorithm? Thanks in advance. rgds
Zakwayda
Zakwayda
The first question to ask is whether you really need per-triangle collision detection. If so, then bounding volume trees/hierarchies are probably what you're looking for. AABBs and OBBs are common choices; a google search may turn up some info. Or if you can afford a book, both Gino van den Bergen's and Christer Ericson's books have chapters on BVHs. IIRC there are also a number of coldet libraries available online that use BVHs, so that might be another useful reference.
SuperNerd
SuperNerd
Could you create a simpler 3d model of each complex one to reduce the amount of triangles needed? It would pretty much the basic shape of the 3D Model and not all of the detail. You would draw the complex model and do collisions with the simple one.

[Edited by - SuperNerd on October 15, 2005 6:56:57 PM]
leoptimus
leoptimus
Check Coldet Code:
photoneffect.com/coldet
It is one of the fastest code for check if two trimeshes intersects.

Also, you can use OPCODE at www.codercorner.com/Opcode.htm, that is an optimized library for check trimesh intersections.
It's better to reuse those libraries than building one from your own. They've optimized, and they've tested on many applications.

However, that collision routines for trimeshes are incomplete for physics, because they doesn't calc distance querys and penetration depht. For that, you'd need another approach, like Jiggle at: www.rowlhouse.co.uk/jiggle/
"Technocracy Rules With Supremacy" visit: http://gimpact.sourceforge.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.