ISO collision detection tutorials

An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011108/97ed1a51/attachment.asc

Howdy -

I just finished John Hall’s book “Programming Linux Games” and I’ve been working on some projects. He outlines a method for collision detection where every object has a bounding circle, and when one spaceship fires at the other, he checks if the phaser touches the bounding circle.

This seems like a good idea when there is a small number of objects to check, or when the checks don’t need to be made that often. Do good tutorials/libraries already exist that do stuff like collision detection?

Thanks for the help.

Bounding circles should be used in any event, on any object, for the initial check - to speed up things.

It is then up to the author to go into more detailed collision analysis, based on the shape of the object. Clearly, if the object shape is close to a circle, it might be sufficient to do this check, but if more detailed objects are present, a more precise approach should be used, once a collision with the bounding circle has been detected.

One method that I have used for several games is to approximate the shape of the object with boxes, and then do simple checks on these boxes to raise the granularity of the collision detection.

Regards
Anders

I just finished John Hall’s book “Programming Linux Games” and I’ve been working on some projects. He outlines a method for collision detection where every object has a bounding circle, and when one spaceship fires at the other, he checks if the phaser touches the bounding circle.

This seems like a good idea when there is a small number of objects to check, or when the checks don’t need to be made that often. Do good tutorials/libraries already exist that do stuff like collision detection?

If you are using OpenGL, then there is a way you can hardware accelerate
your collision detections (when I say “hardware accelerate”, i mean
directly use your graphics processor to do collision detections). This
was a method I deduced two weaks ago, and I don’t really know if it is
more efficient than actually writing libraries that are specific to
collision detection (independent of the graphics library you are using
eg. OpenGL or DirectX).

If you are using OpenGL, then I can specifically tell you what it is!

Along with the above hardware optimization, if you club BSP trees,
collision detection can be so fast that you will hardly suffer a frame
rate loss.

The hardware acceleration is very easy to program - and I really mean
very easy. I was only doubtful about one thing though, i.e., if the
method I have deduced is so easy, then why isn’t it mentioned anywhere,
including http://www.opengl.org. Or may be I haven’t searched enough to
find it on the net!!! (which means it is a standard method :wink:

Anyway, as I already mentioned, all the above holds only if you are
using OpenGL!!! :wink:

Regards,
Nishal Thomas.

If you are using OpenGL, then I can specifically tell you what it is!

Can you explain your method, please ? It can be interesting :slight_smile:

Regards,
Clement.–
Clement “phneutre” Bourdarias
phneutre at mangoquest.org
www.mangoquest.org

Hi there,

circles, boxes… they are still approximations, that can be used for a fast-check.
If you wanna use a algo that use the exact shape of your sprite, the better is
to use a mask for each other (pixel-precision), then to shift them together
(according to their respective directions, speed & move), and to see if they
overlap. Processing bit shifts over bitmasks is still very fast if you use optimized
algo.

Here is one from M. Mackley (don’t remember the URL) of the bests I’ve ever
found (in pascal, easy to recode in C).
Please read the licence info at the end of the .txt file!

HIH

Regards,–
wwp
-------------- next part --------------
A non-text attachment was scrubbed…
Name: collide.pas
Type: application/octet-stream
Size: 7693 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011108/282b22a6/attachment.obj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: collide.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011108/282b22a6/attachment.txt

The hardware acceleration is very easy to program - and I really mean
very easy. I was only doubtful about one thing though, i.e., if the
method I have deduced is so easy, then why isn’t it mentioned anywhere,
including http://www.opengl.org. Or may be I haven’t searched enough to
find it on the net!!! (which means it is a standard method :wink:

Anyway, as I already mentioned, all the above holds only if you are
using OpenGL!!! :wink:

go ahead, i am using OpenGL and i am curious.
what is your technics ?

could you explain ?
send code sample or link to code sample ?

go ahead, i am using OpenGL and i am curious.
what is your technics ?

SDL does not provide any collision detection, so this is
very much off-topic. Please take it somewhere else