Setting collision parameters

2011-03-18 Andreas Löw

Complex objects like the ones you can define inside PhysicsEditor consist of several shapes (fixtures). Both chipmunk and box2d combine these into bodies.

One important thing is that even simple shapes might get divided into several polygons - e.g. if one polygon is concave. In this case PhysicsEditor decomposes them into convex polygons and distributes mass according to the size of each polygon.

PhysicsEditor treats convex shapes as one shape. This means if you set parameters for a convex shape all concave sub shapes share the same values. The loader composes a body with all of them - so you don't have to care about that.

Physics parameters

PhysicsEditor - Chipmunk fixture parameters

Chipmunk fixture parameters

Shapes have physics parameters. They define how a body is moved by the physics engine.

Mass / density

Mass / density tells the physics engine how heavy an object is. This has effect on collisions between objects. It does not have any effect on how fast the bodies fall.


Friction comes in play when one object slides on another. Low friction lets the object slide a longer distance, higher values make the object stop faster.

Restitution / elasticity / bounce

Restitution, elasticity or bounce are used when objects collide. They get repelled depending on the strength of this value. E.g. a basketball will usually have a high value here, whereas a block of steal will have a low value.

Surface velocity (x,y) [chipmunk only]

This value can be used to create conveyor belts. The value creates a speed component on objects that collide / rest on the body.

Collision parameters

PhysicsEditor - Chipmunk collision settings
Chipmunk collision settings

Additionally collision parameters can be set directly from PhysicsEditor.


This value tells the physics engine that the shape is only used to create inform your main program about the collision but the shape itself does not collide with other objects.


This is the collision type. Use this value to set up dedicated collision handlers using cpSpaceAddCollisionHandler.

The default exporter/importer for chipmunk added to PhysicsEditor uses int as cpCollisionType - the default for the chipmunk engine. You might want to change this by modifying the exporter.


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. The default exporter/importer for chipmunk uses int as cpCollisionGroup which is the default for chipmunk.


Shapes only collide if they are in the same bit-planes. i.e. (a->layers & b->layers) != 0. By default, a shape occupies all bit-planes. You can set names for simpler reference in the left column under Bit's name. To add a shape to a specific layer set the checkmark in the right column under Layers.

Did you like the tutorial? Please share!