Ported to JavaScript from ActionScript by Yadurajiv. Click and drag below to draw shapes and render them as Box2D physics objects.

What makes this cool is the ability to draw concave polygon shapes. Box2D can't do this natively, but that's solved here by decomposing concave shapes into a mesh of triangles.