Skip to main content

pymunk is a easy-to-use pythonic 2d physics library built on top of Chipmunk

Project description

About

pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python. It is built on top of the very nice 2d physics library Chipmunk.

2007 - 2012, Victor Blomqvist - vb@viblo.se, MIT License

This release is based on the latest pymunk release (3.0.0), using chipmunk 6.1.1 (source included)

Homepage:

http://www.pymunk.org

Forum:

http://chipmunk-physics.net/forum/

Email:

vb@viblo.se

Getting the latest SVN copy:

svn checkout http://pymunk.googlecode.com/svn/trunk pymunk-read-only

Chipmunk:

http://chipmunk-physics.net/

How to Use

pymunk ships with a number of demos in the examples directory, and its complete documentation including API Reference.

If chipmunk doesnt ship with a chipmunk binary your platform can understand (currently Windows and Linux 32bit and 64 bit are included) you will have to compile chipmunk before install. See section CHIPMUNK in this readme for (very simple) instructions.

To install you can either run:

> python setup.py install

or simply put the pymunk folder where your program/game can find it. (like /my_python_scripts/yourgame/pymunk). The chipmunk binary library is located in the pymunk folder.

The easy way to get started is to check out the examples/ directory, and run ‘run.py python arrows.py’ and so on, and see what each one does :)

Example

Quick code example:

import pymunk               # Import pymunk..

space = pymunk.Space()      # Create a Space which contain the simulation
space.gravity = 0,-1000     # Set its gravity

body = pymunk.Body(1,1666)  # Create a Body with mass and moment
body.position = 50,100      # Set the position of the body

poly = pymunk.Poly.create_box(body) # Create a box shape and attach to body
space.add(body, poly)       # Add both body and shape to the simulation

while True:                 # Infinite loop simulation
    space.step(0.02)        # Step the simulation one step forward

For more detailed and advanced examples, take a look at the included demos (in examples/).

Dependencies / Requirements

  • python (tested on cpython 2.6, 2.7 and 3.2. Also on pypy 1.9)

  • chipmunk (pymunk ships with a set of chipmunk libraries)

  • pygame (optional, you need it to run most of the demos)

  • pyglet (optional, you need it to run the moon buggy demo)

  • sphinx (optional, you need it to build documentation)

  • ctypeslib & GCC_XML (optional, you need them to generate new bindings)

Chipmunk

Compiled libraries of Chipmunk compatible Windows and Linux 32bit and 64bit are distributed with pymunk. If pymunk doesnt have your particular platform included, you can compile Chipmunk by hand with a custom setup argument:

> python setup.py build_chipmunk

The compiled file goes into the /pymunk folder (same as _chipmunk.py, util.py and others). If the compile fail, please check the readme in chipmunk_src for generic instructions on how to compile with gcc, or download the relevant release from Chipmunk homepage and follow its instructions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymunk-3.0.0.zip (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymunk-3.0.0.win32.exe (614.9 kB view details)

Uploaded Source

File details

Details for the file pymunk-3.0.0.zip.

File metadata

  • Download URL: pymunk-3.0.0.zip
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymunk-3.0.0.zip
Algorithm Hash digest
SHA256 effa4d2a9564914180c41c748e5ca91f84723c53696d310d763711c414a4a933
MD5 13bbf409aa5ecef751b283bcf057a59b
BLAKE2b-256 7ae92d571cf38ab9ed18576b846cc7ae169e02d9becaf144fa26242f76cbf868

See more details on using hashes here.

File details

Details for the file pymunk-3.0.0.win32.exe.

File metadata

  • Download URL: pymunk-3.0.0.win32.exe
  • Upload date:
  • Size: 614.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymunk-3.0.0.win32.exe
Algorithm Hash digest
SHA256 c2652e8cdb2d13634a8a461fa824f39a719cd3c8186ecea6e5805df78b5c733f
MD5 1cb7f8e73d33abcd5b0a98447c70c8eb
BLAKE2b-256 f77018b642237fde86b9811a0372b3adee640425b5a3e9f71f6ac5e8025e50c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page