Package pymunk
[frames] | no frames]

Package pymunk

pymunk is a easy-to-use pythonic 2d physics library that can be used whenever you need 2d rigid body physics from Python.

Homepage: http://code.google.com/p/pymunk/

Forum: http://www.slembcke.net/forums/viewforum.php?f=6

Chipmunk documentation: http://code.google.com/p/chipmunk-physics/wiki/Documentation


Version: $Id: __init__.py 270 2010-03-07 21:17:59Z vb@viblo.se $

Submodules

Classes
  Space
Spaces are the basic unit of simulation.
  Body
A rigid body
  Shape
Base class for all the shapes.
  SegmentQueryInfo
Segment queries return more information than just a simple yes or no, they also return where a shape was hit and it's surface normal at the hit point.
  Circle
A circle shape defined by a radius
  Segment
A line segment shape between two points
  Poly
A convex polygon shape
  Contact
Contact information
  Arbiter
Arbiters are collision pairs between shapes that are used with the collision callbacks.
  BB
Simple bounding box class.
  Constraint
Base class of all constraints.
  DampedRotarySpring
Like a damped spring, but works in an angular fashion
  DampedSpring
A damped spring
  GearJoint
Keeps the angular velocity ratio of a pair of bodies constant.
  GrooveJoint
Similar to a pivot joint, but one of the anchors is on a linear slide instead of being fixed.
  PinJoint
Keeps the anchor points at a set distance from one another.
  PivotJoint
Simply allow two objects to pivot about a single point.
  RatchetJoint
Works like a socket wrench.
  RotaryLimitJoint
Constrains the relative rotations of two bodies.
  SimpleMotor
Keeps the relative angular velocity of a pair of bodies constant.
  SlideJoint
Like pin joints, but have a minimum and maximum distance.
Functions
 
init_pymunk()
Call this method to initialize pymunk
 
moment_for_circle(mass, inner_radius, outer_radius, offset=(0, 0))
Calculate the moment of inertia for a circle
 
moment_for_segment(mass, a, b)
Calculate the moment of inertia for a segment
 
moment_for_poly(mass, vertices, offset=(0, 0))
Calculate the moment of inertia for a polygon
 
moment_for_box(mass, width, height)
Calculate the momentn of inertia for a box
 
reset_shapeid_counter()
Reset the internal shape counter
Variables
  version = '1.0.0'
The release version of this pymunk installation.
  chipmunk_version = '5.x.xr428'
The Chipmunk version compatible with this pymunk version.
  inf = 1e+100
Infinity that can be passed as mass or inertia to Body.
Function Details

reset_shapeid_counter()

 

Reset the internal shape counter

pymunk keeps a counter so that every new shape is given a unique hash value to be used in the spatial hash. Because this affects the order in which the collisions are found and handled, you should reset the shape counter every time you populate a space with new shapes. If you don't, there might be (very) slight differences in the simulation.


Variables Details

version

The release version of this pymunk installation. Valid only if pymunk was installed from a source or binary distribution (i.e. not in a checked-out copy from svn).
Value:
'1.0.0'

chipmunk_version

The Chipmunk version compatible with this pymunk version. Other (newer) Chipmunk versions might also work if the new version does not contain any breaking API changes.

Note: This is also the version of the Chipmunk source files included in the chipmunk_src folder (normally included in the pymunk source distribution).

Value:
'5.x.xr428'

inf

Infinity that can be passed as mass or inertia to Body. Use this as mass and inertia when you need to create a static body.
Value:
1e+100