Box2d - Is there a way to group bodies?

Hi guys,

I just started experimenting with box2d and I am trying to do something which seems simple but I am not sure on how to make it work.

I am creating 3 bodies (3 lines forming an open box) and I want them to behave like one object. Is there a way to group them somehow so when you apply a force onto them, they dont break apart but rather keep their shape?

Hopefully the patch can help you understand if I dont make sense…



testForce.v4p (26.0 kB)

Same patch, this time without the subpatches so it should work.


testForce.v4p (37.1 kB)

hi Dorosp.

you want to do something like this?

I add things I’ve done with Box2D in github, I hope you find it useful.

Hi obernardoo,

That is great man, thanks a lot.
Exactly what I needed.