ARPhysics

ARPhysics is a real-time 2D rigid-body physics library, written by me as my final-year Computer Science undergraduate project while at the University of Plymouth. It takes the form of a static library that can be linked in any other project. It is written using standard C++11 so it can be complied for any platform using a compliant compiler.

A cloth like simulation

The Structure of ARPhysics

There are five basic objects that exist in ARPhysics:

World

The world is the space where all the simulation of objects occurs. Bodies, constraints, and force generators are added to a world be be simulated.

Spatial Indexing

The spatial indexing object is the system that controls the organization and collision detection of the bodies in the world. Each World object requires a single SpatialIndexing object. This is designed so that the broadphase collision detection system can be easily changed for different types of game. At the current time the library includes a single brute force spatial indexing system to demonstrate how a SpatialIndexing object should work.

Body

The base element of simulation is a Body object. This is the object that has physical properties and is affected by forces. In the base library there are two types of body: CircleBody and PolygonBody.

Force Generator

A force generator object can provide forces to a set of bodies. This can be used to implement effects such as gravity or an explosion.

Constraint

A constraint is an object that joins to bodies together and limits their movement. It can be used to implement ropes, springs and other such concepts.

Tutorials

  1. Creating a simple simulation