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

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.

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.

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.

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…