Colisions

Hi, is there an algorithm/libraries or some functions in openGL to check if two objects are occupying the same space?

Thanks

There are a lot of algorithms for collision detection. I’ve got two books completely devoted to those algorithms:

  • Real-Time Collision Detection, The Morgan Kaufmann Series in Interactive 3D Technology, 2005
  • Collision Detection in Interactive 3D Environments, The Morgan Kaufmann Series in Interactive 3D Technology, 2004

Chapter 17 of Real-Time Rendering is also a great overview of collision detection techniques.

Useful links:
http://www.realtimerendering.com/intersections.html
http://www.gamespp.com/algorithms/collisiondetection/

Thanks!

Also check out the SIGGRAPH 2010 Course Notes on this course:

Bullet’s worth your time to check out.

Another question about this,

Is there some methods to detect in openGL when a pixel is drawed two times? (two objects colliding)

Where can I find information about?

Thanks

Even if they are drawn at the same place, it doesn’t mean two fragments collide.

True, they can the two objects can have a diferent z value. However, it’s an approach of collision detection with openGL. After that we will need to check if the z value is the same (that’s another history for the moment). So, is there a way in openGL to check that?

What first comes to my mind is to use multi-pass shader.
In the first pass (in FS) draw first object into the texture, and in the second pass (also in FS) read appropriate value form the texture and compare with the current fragment. Write the result into the same or different texture and read from the application. I’m not sure how fast this will be, but if you confine collision to a fairly small area I guess it would be fast enough.

Maybe not of use (2D), but there is also this idea
pixel-perfect collsions using occulsion query