I am making a game with a sort of "playfield" where the game takes place, acting as boundaries on a top-down shooter. I am using Box2D for physics, and I am questioning which of the following would be the most efficient. One option would be to have the playfield represented by a single static body, with four fixtures attached to it (top, bottom, left, and right walls). The other option would be to have four static bodies, one for each border fixture. Which is the fastest for Box2D to process?
I know this is probably late but an answer can be found here: https://stackoverflow.com/a/21172599.
"It is faster to attach several shapes to a static body than to create several static bodies with a single shape on each one. Internally, Box2D sets the mass and inverse mass of static bodies to zero. This makes the math work out so that most algorithms don't need to treat static bodies as a special case."