[pymunk] Pymunk and PyGame coordinates
-
- Posts: 1
- Joined: Wed Jun 25, 2008 2:58 am
- Contact:
[pymunk] Pymunk and PyGame coordinates
Pymunk/Chipmunk uses a coordinate system with the origin at the bottom left. PyGame/SDL uses a coordinate system with the origin at the upper left. The examples for Pymunk use a flipy() function that converts Pymunk coordinates to PyGame coordinates. However, I don't see why this is necessary. Is there any downside to simply having everything upside-down in Pymunk and not using the flipy() function?
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: [pymunk] Pymunk and PyGame coordinates
I'm guessing it'd mean you'd have to reverse polygon winding. Plus having y values increase as the height decreases seems old-fashioned and confusing.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: [pymunk] Pymunk and PyGame coordinates
There is nothing in Chipmunk that assumes that which way any of the axes are pointed. Maxamile is correct that it will reverse the polygon winding direction, as well as the rotation of all bodies. This has confused a few people so far.
I find the "classical" cartesian coordinate setup to be the path of least resistance. It's a little more intuitive, but most importantly, it's what all your standard math training has taught you to think. Otherwise you will have to add lots of sign flipping when using standard math functions. I'm assuming that's why Pymunk just flips the coordinates as a last step.
I find the "classical" cartesian coordinate setup to be the path of least resistance. It's a little more intuitive, but most importantly, it's what all your standard math training has taught you to think. Otherwise you will have to add lots of sign flipping when using standard math functions. I'm assuming that's why Pymunk just flips the coordinates as a last step.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 206
- Joined: Tue Aug 21, 2007 3:12 pm
- Contact:
Re: [pymunk] Pymunk and PyGame coordinates
I just want to clarify, some of the examples shipped with pymunk does the flip coordinate thing, not the wrapper itself
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
Who is online
Users browsing this forum: No registered users and 12 guests