I understand that openGL is an API and also a set of functions for creating primarily primitives on a screen. As an API, I understand it does not natively support what modeling and game graphics engines would.

However, I still desire to understand through underlying math the simplicity of collision detection. I have read through the Swiftless, NeHe, and plenty of other online tutorials but none of them put it together for a 3D app in simplicity. NeHe uses some overbloated and complicated mess of garbage to demonstrate collision and others use oversimplified 2-D mechanics or don't cover 3d dungeon crawling.

I am looking for a cut and dry approach to collision in a 3d environment that does not require me to write 500+ lines of code for it. I have a dungeon, call it that or a maze, generated from a file with nice high walls, wide corridors, pastel colors and the ability to walk through every wall and cheat my way to treasure hidden inside (teapot ftw).

I have thought of many ways to do this in addition to studying the tutorials but I am just stumped. My professor thought it was cool to cover not an ounce of collision but make me do it. I just want a true plain jane simple with code understanding of one way, a method, to do it and use it until I wanna learn another method.

Please help.

Jexxxie

06-06-2010, 10:10 PM

i. Divide your level into a quad tree so that objects far from the player are not concidered.
1. Check distance from player to polygon's centeroid to see if collision is feasable.
2. do bounding cube or bounding sphere check.
3. Do in depth poly-to-poly check.

Alfonse Reinheart

06-06-2010, 11:06 PM

I am looking for a cut and dry approach to collision in a 3d environment that does not require me to write 500+ lines of code for it.

If you're not looking to write actual code (being more than 500+ lines), then you're not going to get very far in making a "3d dungeon crawling" game.

Both Bullet Physics and ODE are reasonably adequate solutions for doing 3D collision detection. But even that is going to take code to integrate with the rest of your system. Probably more than 500+ lines of it.

If you're looking for the short path for making a game, buy an Unreal game and use its engine to make what you're looking for. It'll save you a lot of time and hassle.

nickels

06-07-2010, 08:28 AM

Try downloading the quake3 source code. This will give you a bit of an idea what you're in for. You can generate levels with their tools and then read in the file and use their BSP tree to do your world collision. You might actually get away with 500 lines of code, but it will be utiliting their 100k lines of code to get there!!