Hi so i've recently learned the SFML graphics library and would like to use or make a non-rigid body 2D physics system to use with it. I have three questions:

The definition of rigid body in Box2d is

A chunk of matter that is so strong that the distance between any two bits of matter on the chunk is completely constant.

And this is exactly what i don't want as i would like to make elastic, deformable, breakable, and re-connection bodies. 1. Are there any simple 2D physics engines, but with these kinds of characteristics out there? preferably free or opensource?

2. If not could i use box2d and work off of it to create it even if it's based on rigid bodies?

3. Finally, if there is a simple physics engine like this, should i go through with the proccess of creating a new one anyway, simply for experience and to enhance physics math knowledge? I feel like it would help if i ever wanted to modify the code of an existing engine, or create a game with really unique physics.


  • 1
    \$\begingroup\$ There was this engine called JelloPhysics (C#), but the site seems to be down. There's a video here: youtube.com/watch?v=SvqY_pgA6DU \$\endgroup\$ – bummzack Jun 28 '11 at 6:23

You can use rigid body systems to create soft body and fluid dynamics. Physical reason behind it? Well, essentially, atoms are small rigid bodies. This isn't completely true of course, but for simplicity you can view them as such. And soft bodies are obviously made from atoms.

So, how do you create "soft bodies" using a rigid body engine like Box2D?

The essential technique is to bind points in your body together using joints. For example, if you connect the ends of a list of lines together using distance joints (meaning the distance between two joints must be constant), it will roughly behave like a piece of cloth.

But that's just a rough description. A lot of "elementary field work" with Box2D has been done by ewjordan, one of the developers of the Java-port of Box2D. Here's a good starting point: http://www.box2d.org/forum/viewtopic.php?f=8&t=1978

  • \$\begingroup\$ A mix of tension/compression springs are needed to keep the "shape" of the soft body, as well as calculating the volume to keep it whole. \$\endgroup\$ – Jonathan Connell Jun 28 '11 at 9:22
  • \$\begingroup\$ Yes, but all of that is actually done via joints, if we're talking about Box2D. Sure he'll manually have to alter their behaviour, but that's where he has to start. For constant volume effects in Gish-like blobs for example, JBox2D has ConstantVolumeJoint. \$\endgroup\$ – TravisG Jun 28 '11 at 9:24
  • \$\begingroup\$ Yeah I'm not that familiar with Box2D, I just know how some collegues used PhysX to simulate a bubble ^^ \$\endgroup\$ – Jonathan Connell Jun 28 '11 at 9:49

The term you are looking for is soft-body physics.

Wikipedia has a nice list. They're all 3D AFAICS, but should be good.

Also check out this SO question.

A great book (it's rigid body, but all the maths and physics are there; it's also 3D, but is trivial to transfer to 2D) is Game Physics Engine Development. It implements a particle based system before moving onto rigid bodies and collision.


One simple way to simulate soft bodies is to connect together small rigid bodies with elastic joints. Then the difficult part is to fine tune your model's parameters and map the texture to the underlying model.

The following blog post provides an implementation of a deformable ball with cocos2d engine: http://2sa-studio.blogspot.com/2014/05/soft-bodies-with-cocos2d-v3.html

  • \$\begingroup\$ credits to cocos2d debug draw ;-) \$\endgroup\$ – sdabet Apr 2 '15 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.