How to make P2 Rectangle bodies behave like one body(shape)

I’m creating rectangles in p2 physics. You can draw on canvas with mouse and it will create visual as well as physics bodies. I’ve used LockConstraint and DistanceConstraint to keep rectangle bodies together.

They are created as static and once you complete drawing they are made dynamic. It’s working as expected but I want the shape that’s drawn to remain same. right now they are locked with each other but shape is lost once it’s dynamic.

I want this bodies to be dynamic but don’t want the overall shape to change. I’ve also tried using PrismaticConstraint and RevoulteConstraint. I think PrismaticConstraint should have worked but it didn’t. Maybe I don’t know how to use it properly.

Any help is greatly appreciated. :smiley:

Here is the example.