[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Physics, collision detection etc?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Physics, collision detection etc?
- From: "Nirav Patel" <olpc@xxxxxxxxxxxxxx>
- Date: Mon, 6 Oct 2008 12:05:21 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 06 Oct 2008 12:05:25 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=o1FHSMvQJSMRLGsgljjjBpY6k/rp1iz5R85ixb9BAoY=; b=JvbhASJXstoa1CFDO0mjYBMUS1JYHQHZqScnbrPzs8I7MD3NZFYJTkBLx1aUK4jRZ+ IKCPTnH4enviDA2zJGe+Kn6GWObcxYRPV98fl982/NssjXtYwoqRZpfLPxxKkJguOivI kcqq8RKsHGz78rIYjf1BStQsbbweMceWG5fVg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=Qv3+QnqOdK53YdVNWpOUEtn96KNBaIlsAvguDjncjlTy3wML1OQum4t7g71P4nBo4u 4/B2RjEYDMIB2PEq1BwpAY+5sXCrFGGfc1WJMhGCPuS04228XGR1m+xPtebiv/35rmRU b9cx86d4rLSzybXbHVgfSnyJVulIXi5T1gKW8=
- In-reply-to: <20081006152715.GA4081@home>
- References: <20081006152715.GA4081@home>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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
>