I’m trying to create static bodies with ofxBox2d, and I’m using the approach from when using box2d before.
when creating my ofxBox2dRect I set density to 0.0.
roomFloor.setPhysics(0.0, 0.53, 0.0); roomFloor.setup(box2d.getWorld(), 300, poss, 800, 100);
later on I want to update the position, (i’m creating a room, floor, left wall right wall etc) I’m trying to update the bodyDef.position.Set(x,y);
I get no compile errors and it should work, I think from reading the box2d docs.
any suggestions for a different approach would be welcomed. I did try setup(); but it seems it just updates visually (last setup) collisions still occur where the object used to be. So my understanding is that box2d is just adding lots and lots of objects.
---------- SOLVED -----------
Okay, I checked out the header file of ofxBox2dBaseShape and found the methods for setting position etc. much easier than trying to tinkle with bodyDef manually. Also this probably exaplains why x,y,width,height is kept private in most classes.