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

Re: [pygame] Physics, collision detection etc?



Hey Nirav!

Yep, but as I said, I need to find colliding polygons, not pixels.

/Peter

On 2008-10-06 (Mon) 12:05, Nirav Patel wrote:
> Peter,
> 
> There are some new functions in SVN in the mask module.  New ones
> since 1.8.1 that could be useful for collision are:
> 
> Mask.overlap_mask - Returns a mask of the overlapping pixels
> Mask.draw - Draws a mask onto another
> Mask.erase - Erases a mask from another
> Mask.count - Returns the number of set pixels
> Mask.centroid - Returns the centroid of the pixels in a Mask
> Mask.angle - Returns the orientation of the pixels
> Mask.connected_component - Returns a mask of a connected region of pixels.
> 
> The mask module does pixel collisions pretty quickly.  I think on
> modern systems it shouldn't be a significant difference (compared to
> say, blitting) between using pixel perfect detection and something
> like the seperating axis theorem.
> 
> Nirav
> 
> On Mon, Oct 6, 2008 at 11:27 AM, Peter Gebauer
> <peter.gebauer@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > Hey guys!
> >
> > I've been looking around for various libraries that handle
> > intersection/colliding polygons/line segments, I'm just wondering if/when
> > there will be polygon shapes and additional collision testing functions
> > that can be used seemlessly with the old rect and mask libraries that
> > already exist in PyGame?
> >
> > /Peter
> >
>