Results 1 to 8 of 8

Thread: How to test for collisions?

  1. #1

    How to test for collisions?

    I just started learning OpenGL and it doesn?¢_Tt seem too hard. One thing that I have absolutely no idea how to properly do is collision detection in 3D, the only half decent way I can think of is using a load of bounding boxes grouped in larger and larger boxes, but that way the form of the world would be very limited. Maybe someone has some ideas for a universal method of testing collisions?

  2. #2

    How to test for collisions?

    There are several ways of doing this. Of course bounding boxes and bounding spheres are the most important elemts of collision detection. They are fairly fast, easy and usefull. For example it is usefull to pre-check. Use a big sphere to check, if the object had been hit, use smaller spheres or boxes to check the exact part that had been hitting. I also can point to a piece of code that was contribute for our site:
    http://www.delphigl.com/
    http://www.phobeus.de/hosting/dgl/ma...oadinfo&f=3051 The source
    http://www.phobeus.de/hosting/dgl/ma...tetris&print=1The Description to it, two links are at the bottom.

    Maybe you can find something usefull

    Phobeus
    Delphi & OpenGL? A contradiction? Not at all...
    <br />www.delphigl.com - German OpenGL Community

  3. #3

    How to test for collisions?

    Funny you mention this,.. I'm currently teasing my brains with a 2D pixelperfect collision detection routine (in opengl), for about an entire day now. It's harder than I thought.

    Anyway, perhaps lesson 30 on nehe's site, might be useful to you.

  4. #4

    How to test for collisions?

    *pushingtopictothetop*

    How did your PixelCorrect Collision Detection work out??

    Can you give me some code?

  5. #5

    How to test for collisions?

    It didn't

    The collision detection routine was supposed to be for my entry for the 2003 remakers competition. However i did not finish it on time and the project was abandoned.

    After that I never laid eyes on the code again. But I will in a few weeks as I'm going to need it for my current project.

  6. #6

    How to test for collisions?

    I think that pixel perfect 2D collision detection is useless, a much better approach speed wise would be to hierarchically approximate images with many circles.

  7. #7

    How to test for collisions?

    I think for my needs, pixel perfect collision is the best way.

    Can you get hold of the pixels in openGL?
    Like .pixels(x,y) -> color of the pixel

  8. #8

    How to test for collisions?

    Can you get hold of the pixels in openGL?
    Huh? You can read back from the frame buffer, but it is horribly slow and what would you do with that? OpenGl is a rendering API and it won't help you with collision detection. To do pixel level collision detection you would need to keep all you're images pixels(or just their corresponding IsCollidable values) in system memory, transform one images edge coordinates to the other ones local space and go through both images looking for IsCollidable values. The only situation in which this method wouldn't have to perform billion's of operations is if you're images would have constant orientation, but since you're using OpenGl it is very unlikely that you wont want to do rotations and such.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •