Distance joint Vs. Max Distance joint

I was taking a look at some excellent demos here: http://andrew-hoyer.com/experiments/cloth/

Of course, I thought “this can be done easily in Corona.”

I was right, because of the excellent Box2D engine, but I was also confused, because I decided to use the distance joint. The problem with that is that the distance is kept at the length of the joint. Although the joint itself can be somewhat squishy, this is not really enough and what you end up with is points on the “cloth” getting caught against other points:

2014-04-10_1731.png

To fix this, I have applied a collision filter of -2 (which, to be honest, had no effect) and some damping of sorts on the distance joints:

frequency = 1 dampingRatio = 1000

I’m not happy with this, however, and I’d like to find a way to make this demo behave much more like the demo above.

You can grab my source code here: https://dl.dropboxusercontent.com/u/10254959/Demos/Cloth/Cloth.zip