Does anyone know where i can get a tutorial and example code on how to use collision detection with games in opengl
John Nagle, I must thank you very much for your links to V_COLLIDE and SWIFT.
There was a huge list of sites posted a few weeks back. Doesn’t anyone use search on here anymore? There are TONS of great posts on this and most everything else you can think of.
I can not thank you enough for these links
How about tutorials on how to use these… Does anyone know how to apply this to opengl!?
What do you need? OpenGL is NOT used at all. It is ONLY for rendering.
It also depends which method you are going to use in your collision routines, and if you are using rectangles, triangles, or circles or whatever. Just feed whatever you are using into the collision routine, THEN render with openGL what happens, like a big KABOOM when a bullet hits the gas tanks.
I think i have it now, it’s like collision detection is used for that, opengl rendering, direct input input… so on.
I’m using triangles btw
Also coldet (http://photoneffect.com/coldet/ ) is a very handy library for collision detection. I use it in one of my works-in-progress (http://www.wizards.de/~frank/project2501/ ) with great success.
But mind the words of the jogi masters - while collision detection is easy, good response is hard
For a simple case such as firing bullets at a target, you could try using the select mode in OpenGL. Use an ortho view the width of the bullet, from the initial position of the bullet, looking in the direction the bullet is moving, and with the far limit set to the distance the bullet will move in this frame. Now draw the target. If the number of entries in the select list is 0, you missed. Anything greater than 0 and you hit it somewhere.
The direction vector I used had to be relative to the target, since the target speed was not negligible.
This wouldn’t suit cases where neither object can be treated as a point, but it was good enough for my purposes and the main part of the new code was only about a dozen statements…
The main problem I think is that the technique you describe will not be very fast where real collision detection is needed.
It may happen that this technique can be used for a quick’n’dirty test but you shouldn’t create a whole collision detection system based upon this.
Does anyone know where i can get tutorials on coldet? I’ve seen it, but I didn’t bother cause I didn’t see any docs on using it…!?