pyode

It's like magic.

pyode

Postby Wopple » Sun May 31, 2009 10:57 pm

I'm trying to learn how to use pyode. I'm starting with 2D for now. To that end, I'm trying to create a simple pyode environment that I can play around with. I have been following the 3 tutorials here:

http://pyode.sourceforge.net/#starting

I was able to follow along with the first two, but the third one which goes over collisions has been failing me. I tried simply copy and pasting the given code, but it seg faulted. :? So I tried to write my own code using Pygame. I have two boxes falling onto a floor, but they don't behave anywhere near as expected. I'm also probably drawing them incorrectly because they will more often than not just pass right through each other.

Q: How do I draw an object such as it is represented in pyode?

I think I need this answered for me before I move on so I don't get confusing feedback from my tests. If you would like to run and / or peruse my code, you can get it here:

http://www.cs.rpi.edu/~tashjd/bad_pyode_bad.zip
A day is not complete with out a game of go.
The statements, "I'm up for that." and, "I'm down for that." mean exactly the same thing.
User avatar
Wopple
 
Posts: 17
Joined: Thu Mar 26, 2009 2:00 pm

Re: pyode

Postby Zen » Thu Jun 11, 2009 3:19 pm

Messing with PyOde for 2D is dirty and dangerous. You'll need to fix the z to 0 and limit it to only rotate on the z-axis. There are no options for this, you just have to force it. Otherwise you can make two static planes, one in front, the other behind.

The other problem with drawing it would be getting the right rotation value. Which since your zeroing the z-axis, you'll want the z-axis value for rotation. My head doesn't want to do the rotation matrix magic for that right now but just grabbing the first value isn't probably the solution you need.

If you want to play with 2D physics in python I highly recommend using pymunk. It's a wrapper around the fantastic Chipmunk 2D physics library.
User avatar
Zen
Officer
 
Posts: 27
Joined: Thu Mar 26, 2009 1:31 am
Location: Sitting

Re: pyode

Postby Wopple » Fri Jun 12, 2009 5:12 pm

Zen wrote:My head doesn't want to do the rotation matrix magic for that right now but just grabbing the first value isn't probably the solution you need.


From what I read about rotation matrices, the first value will have the cos of the angle which I needed. But either way, I agree with you that pyode may not be the best way to go. I'll check out pymunk. Thanks.
A day is not complete with out a game of go.
The statements, "I'm up for that." and, "I'm down for that." mean exactly the same thing.
User avatar
Wopple
 
Posts: 17
Joined: Thu Mar 26, 2009 2:00 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron