games

4. iPhone Physics Engine Library

We have open source Chipmunk library to implement physics engine in iPhone gaming apps.
Here is the source

This source is the powerful physics 2D engine to use in iPhone game programming. We can have every motion of any real world object in whatever place it is. We can add gravity, friction, external force which will reflect in the motion of the object. And also we can have collision detection between objects present in the current screen.

The source is self explanatory, but I have summarized the usage of this api for handy use and i’ll keep updating this as far as I explore.

rigid bodies: A rigid body holds the physical properties of an object. (mass, position, rotation, velocity, etc.) It does not have a shape by itself. If you’ve done physics with particles before, rigid bodies differ mostly in that they are able to rotate.
collision shapes: By attaching shapes to bodies, you can define the a body’s shape. You can attach many shapes to a single body to define a complex shape, or none if it doesn’t require a shape.
joints: You can attach joints between two bodies to constrain their behavior.
spaces: Spaces are the basic simulation unit in Chipmunk. You add bodies, shapes and joints to a space, and then update the space as a whole.

Please let me know if you want further explanations.