Informations

PPhys2D is a Processing adaptation of Phys2D, an opensource Java physics system (originally created by Erin Catto). You can find more information about Phys2D here.

Keeping in mind that Processing is made for visual artists first, rather than hardcore programmers. PPhys2D is a simplified version of the original library. It includes the same great physics system, but simplifies its usage and add drawing functionalities right out of the box. It allows nice flexibility so it can be used for visual creation as such as for game programming EASILY.

A human readable documentation allows fast learning for a quick start. Used with the examples, you will be able to use PPhys2D within your project in the next few minutes!

What has been done:

  • Box, Circle, Line and Polygon shapes are supported.
  • Most important functions have been adapted and simplified for Processing users.
  • Drawing all shapes is done in only one line of code !
  • Attaching an image to a shape is done in only one line of code!
  • Easy setup of screen edges as world.

What needs to be done:

  • Joints are currently NOT fully supported.
  • JavaDoc is not ready for distribution.
 

Setting up Processsing to use PPhys2D

When using PPhys2D in Processing, you will need to setup a few things to make it work correctly.

  1. You need to download the library and extract it the Processing libraries folder. (the "pphys2d" folder needs to be inside your "libraries" folder).
  2. Create a new skecth and import PPhys2D library. You can do that using Skecth - Import Library - pphys2d.
  3. You will need to setup a PPWorld object in the setup() section of your sketch. You should take a look at related examples for more information.
  4. You will need to call world.draw(this) in the draw() section of your sketch. You should take a look at related examples for more information.

 

And that's it. Feel free to send us your comments.

Credits

This adaptation of Phys2D has been created by Jean-Maxime Couillard. You can contact me for questions or comments at jm.couillard@globetrotter.net. You may also be interested by my work : jmcouillard.com.

PPhys2D is and adaptation of an existing library named Phys2D hosted by Coke and Code. All the physic engine and mathematical operations where taken from that Java library and are not from my own.

The original Phys2D Library is essentially a port and rework of the GDC 2006 presentation from Erin Catto plus some extensions. You can get more information about this Java library here.