Package pymunk :: Class Shape
[frames] | no frames]

Class Shape

object --+
         |
        Shape
Known Subclasses:

Base class for all the shapes. You usually dont want to create instances of this class directly but use one of the specialized shapes instead.
Instance Methods
 
__init__(self, shape=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__del__(self)
 
cache_bb(self)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties
  id
  collision_type
  group
Shapes in the same non-zero group do not generate collisions.
  layers
Shapes only collide if they are in the same bit-planes.
  elasticity
Elasticity of the shape.
  friction
Friction coefficient.
  surface_velocity
The surface velocity of the object.
  body

Inherited from object: __class__

Method Details

__init__(self, shape=None)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

Property Details

id

Get Method:
unreachable(self)

collision_type

Get Method:
_get_collision_type(self)
Set Method:
_set_collision_type(self, t)

group

Shapes in the same non-zero group do not generate collisions. Useful when creating an object out of many shapes that you don't want to self collide. Defaults to 0
Get Method:
_get_group(self)
Set Method:
_set_group(self, group)

layers

Shapes only collide if they are in the same bit-planes. i.e. (a.layers & b.layers) != 0 By default, a shape occupies all 32 bit-planes.
Get Method:
_get_layers(self)
Set Method:
_set_layers(self, layers)

elasticity

Elasticity of the shape. A value of 0.0 gives no bounce, while a value of 1.0 will give a 'perfect' bounce. However due to inaccuracies in the simulation using 1.0 or greater is not recommended.
Get Method:
_get_elasticity(self)
Set Method:
_set_elasticity(self, e)

friction

Friction coefficient. Chipmunk (and therefor pymunk )uses the Coulomb friction model, a value of 0.0 is frictionless.
Get Method:
_get_friction(self)
Set Method:
_set_friction(self, u)

surface_velocity

The surface velocity of the object. Useful for creating conveyor belts or players that move around. This value is only used when calculating friction, not the collision.
Get Method:
_get_surface_velocity(self)
Set Method:
_set_surface_velocity(self, surface_v)

body

Get Method:
unreachable(self)