Mail Archives: djgpp/1997/04/29/00:26:00
In article <Pine DOT SV4 DOT 3 DOT 94 DOT 970428125700 DOT 28102C-100000 AT aludra DOT usc DOT edu>, rellwood <rellwood AT aludra DOT usc DOT edu> wrote:
>
>A third way is to use bounding circles instead. I have nevery actually
>tried this, but I suppose it could be implemented easily enough using good
>old Pythagorian Theorum, and just measure the DISTANCES between the two
>sprites. If the result is smaller then a certain threshold, you have a
>collision. This is a bit more accurate then bounding boxes, but it is
>somewhat slower because you have to compute square roots.
Actually, you can skip the square root operation by just comparing the
distances *squared* between objects, rather than the actual distance. I
think this makes this approach even faster than the bounding box method.
Don't quote me in this, however, since I haven't actually tested whether its
faster or not!
Note that this approach still isn't pixel-accurate, but if your sprites are
generally circular, it will yield better results than bounding box detection.
Cheers,
Peter
----------------------------------------------------------------------
Peter Monks http://www.geocities.com/Yosemite/4455/
pmonks AT iname DOT com
pmo AT fmsc DOT com DOT au
Peter_Monks AT australia DOT notes DOT pw DOT com
- Raw text -