Re: [pygame] Physics, collision detection etc?

2008-10-17 Thread Peter Gebauer
Hi Niki! Yes I have, a well a Box2D for Python. Neither or Python extensions and neither will be a permanent part of PyGame. There's already a cool physics module part of PyGame, I'll try to see if we can extend it's API further. /Peter On 2008-10-14 (Tue) 10:59, niki wrote: Peter Gebauer

Re: [pygame] Physics, collision detection etc?

2008-10-11 Thread Peter Gebauer
Yo René! Indeed, it would be nice to see a Python extension for this. I still think it'd be nice to use Zhang Fan's wonderful code, it has the basic concepts there, just needs that extra to become a collision testing library as well. From what I understand from Zhang Fan the plan was to provide

Re: [pygame] Physics, collision detection etc?

2008-10-09 Thread Peter Gebauer
Hello René. The thing is, in a large world spanning 16000x1 pixels that will be a huge mask. Even if I reduce the resolution of the mask alone it will be either top inprecise or still too large. I don't want to write for OpenGL alone even though the plan is to use OpenGL as test output.

Re: [pygame] Physics, collision detection etc?

2008-10-09 Thread 帆 张
Hi Peter, I'm so sorry that I'm very busy for my study affairs these days so I stopped this project for a while. In fact, Non-rectangular shapes like circle and polygon are what I've planed and want to finish it in the physics module. I designed some basic interfaces of shape

Re: [pygame] Physics, collision detection etc?

2008-10-09 Thread Nirav Patel
Peter, The idea isn't to make a mask of the entire world. You make a mask of each individual Surface and provide the offset of where it is in the world relative to the Surface you're checking collision with to the Mask overlap functions. This is quite fast, even checking dozens of objects

Re: [pygame] Physics, collision detection etc?

2008-10-09 Thread René Dudfield
hi, it'd be cool if we also had a good kdtree implementation for spatial stuff too :) For cases when we had say 1000 objects or so. note, the wikipedia entry has a basic implementation in python http://en.wikipedia.org/wiki/Kd-tree There's also some quadtree python code lying around if you

Re: [pygame] Physics, collision detection etc?

2008-10-08 Thread Greg Ewing
Nirav Patel wrote: If the polygons are Surfaces or can be turned into Surfaces, they can be turned into Masks to do pixel collision. On Tue, Oct 7, 2008 at 11:21 AM, Peter Gebauer [EMAIL PROTECTED] wrote: Yep, but as I said, I need to find colliding polygons, not pixels. Pixel collision

Re: [pygame] Physics, collision detection etc?

2008-10-08 Thread Peter Gebauer
Hi again Nirav! Yes, but the number of pixels involved makes it too time consuming. Also, I'll be using OpenGL to render the polygons which means I have to copy the pixels to RAM or use occlusion tests, neither of which are optimal. /Peter On 2008-10-07 (Tue) 15:03, Nirav Patel wrote: Peter,

Re: [pygame] Physics, collision detection etc?

2008-10-08 Thread Peter Gebauer
Hello Ian! Nice code! I was thinking of exposing some of the code Zhang Fan wrote for the physics engine, but as of yet it only handles rectangles. There's plenty of code available on the net, but I feel reluctant to produce yet another Python extension for PyGame. I'll continue to check for

Re: [pygame] Physics, collision detection etc?

2008-10-08 Thread René Dudfield
hi, Note, that you can find contact normals with the mask module. See mask example. For some types of games, per pixel collision detection is fast enough. It uses rect bounding boxes as a first pass, so mostly it's not much slower than rect collision detection. Assuming you are working in 2d,

Re: [pygame] Physics, collision detection etc?

2008-10-07 Thread Peter Gebauer
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

Re: [pygame] Physics, collision detection etc?

2008-10-07 Thread Nirav Patel
Peter, If the polygons are Surfaces or can be turned into Surfaces, they can be turned into Masks to do pixel collision. Though, I may be misunderstanding what you are trying to do. Nirav On Tue, Oct 7, 2008 at 11:21 AM, Peter Gebauer [EMAIL PROTECTED] wrote: Hey Nirav! Yep, but as I said,

Re: [pygame] Physics, collision detection etc?

2008-10-07 Thread Ian Mallett
I once wrote a program which collides a point and a convex polygon, returning a boolean result. http://pygame.org/project/649/ This project uses it, for instance. It may be of help.Ian

[pygame] Physics, collision detection etc?

2008-10-06 Thread Peter Gebauer
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

Re: [pygame] Physics, collision detection etc?

2008-10-06 Thread Nirav Patel
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