Why I wrote a wrapper since there were already pymunk for python? I started playing out with pymunk first, but after a long I wanted some convenience (in form of fixed bugs). I Decided to modify pymunk just a bit to add that convenience. My face was about


After I got the velocity function setters to action, I hit this weird thing: gravity vector coming to the velocity updater is zero! It doesn't harm my bindings though, since I don't necessarily need the gravity variable through the velocity updater. Here's some code from my examples:
Code: Select all
poly.collided = 0.0
@pendulum.set_velocity_func
def pendulum_update_velocity(body, gravity, damping, dt):
damping *= 0.95
body.reset_forces()
if poly.collided > 0.0:
n = body.local_to_world(Vec2d(-10000.0, 0)) * poly.collided
body.apply_force(n*body.m, Vec2d(0, 0))
poly.collided -= dt
body.v = body.v*damping + (grav + body.f * body.m_inv) * dt
body.w = body.w*damping + body.t * body.i_inv * dt
@space.collision_pair(0, 1)
def hammer_pack(something, hammer, contacts):
hammer.collided = 0.5
return True
The mercurial repository is there if you want to look in: http://bitbucket.org/cheery/ctypes-chipmunk/