Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Your opinion of my collision detection

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    germany, near hamburg
    Posts
    15

    Your opinion of my collision detection

    Hi,
    I was never good at maths, so I never spent time on calculating a collision-detection.
    But I found another way to do this, and now I'd like to know, whether or not it's useful.
    (Perhaps someone calculated "real" collision-detection and can give me a statement)

    I accessed collision-detection by using the selection-mode. For example, I'm a person moving around in a virtual world. Whenever I'm making a step towards, I switch into selection-mode (glRenderMode(GL_SELECT) , and draw a quad in front of me. Now, I draw the rest of the wold (buildings, trees). Then I switch back to render-mode, an I can now access the selection-buffer - so I can compare the z-values of the objects I've drawn and of the quad I drew in front of me. If any object has a lower z-value then the quad in front of me, I will not be abled to move forward (because I might collide).

    So, what do you think about it? It works, but it spends some time, because every frame the scene is drawn in selection-mode for every "person" moving through the scene.

    thanks,

    mace

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: Your opinion of my collision detection

    Even thoug it works, I strongly suggest you give up the idea of using the selection buffer.

    You said you where never good at maths, and there's the source of your problem. 3D graphics is quite maths intensive, and if you don't understand it, you will have a hard time doing stuff properly from the beginning.

  3. #3
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Sydney, NSW, Australia
    Posts
    426

    Re: Your opinion of my collision detection

    That method is probably slow and it can only be used from 1st person perspective. Say you had a flight sim you couldnt use that way to see if say your missile has hit an enemy fighter or the ground, etc...
    there is a good tutorial on www.flipcode.com on simple ray-triangle intersection collision detection, it isnt v.hard to understand.
    :: Sleep is a poor substitute for caffeine ::

  4. #4
    Member Regular Contributor
    Join Date
    Nov 2000
    Posts
    370

    Re: Your opinion of my collision detection

    I have to agree, skip the idea. And no, don't do stencil tests either.

    While it may work, it will be slow, and it is better to just goto gamedev.net and check all the articles on collision detection. They should help you out.

  5. #5
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Sydney, NSW, Australia
    Posts
    426

    Re: Your opinion of my collision detection

    I suggest reading up in vector maths, also found at www.flipcode.com this is so you understand things like Dot product and cross product, normalised vectors... etc...
    :: Sleep is a poor substitute for caffeine ::

Posting Permissions

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