[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pixel perfect collision detection sugestion



> 1. higher level collisions
> 2. rect level collisions
> 3. per pixel collisions
> Or is there a generic higher level thing even if not using tiles we
> can use that will be fast enough anyway?

I good KD Tree library might help. These are trees that help find
nearest neighbors between a large set of objects. The tree itself takes
time to construct, but once you are dealing with enough objects it
becomes a quicker way to find objects within a radius of other objects.

This also means you'll need to know the maximum size of the sprites, so
you know when to stop searching the nearest points. Then again, it may
be overkill?

http://www.nist.gov/dads/HTML/kdtree.html
http://www.rolemaker.dk/nonRoleMaker/uni/algogem/kdtree.htm