ofxBox2d static shapes


In ofxBox2d; i can’t figure out how to make a body static.
For instance, in the joint example, both static and dynamic entities seem to be setup the same way.
If I copy the setPhysics() values of the dynamic circles and use it to setup the anchor circle, the anchor remains static… The only difference I see is that the anchor circle is not a pointer.

Thanks for your help.

Hi, don’t know if this is the correct answer, but it works for me. I’ve used 0 for the static bodies density. ie:
staticBody.get()->setPhysics(0, 0.5, 0.9); // density, bounce, friction
Hope this works for you too.

Thanks @colormono,
I have learned a bit more in the meantime:
Indeed, In the joint example, physic values were set by default to 0 for the static anchor.
objects can also be set as “static” by directly changing their body type:

anchors[i].get()->body->SetType(b2_staticBody); // (when anchors is a vector of smart pointers to static box2d objects )
1 Like