This project has moved. For the latest updates, please go here.

Static level geometry, should it be all one body?

Feb 11, 2013 at 7:31 PM
Edited Feb 11, 2013 at 7:32 PM
I'm making a game with procedurally generated levels made from blocks. At the moment each static block making up a room is a fixture, a body and shape
Should I just make say, one static body for each room and add all the blocks as shapes to the body? Will this be more efficient? Also can I add and remove shapes from the body without lag, also can the shapes be in any positions without weird behaviour ensuing?
If so does anyone have an example of doing this. Making a single body and adding lots of shapes to it at various positions?
Feb 13, 2013 at 10:32 AM
I have not extensively tested, but genbox has advised that using one body , multiple fixtures is faster. if i remember correctly
Feb 18, 2013 at 4:40 AM
What AlzPatz says is correct. A single body with multiple fixtures is better than multiple bodies.

A body is simply a point in space. A shape is what defines the outline of an object, that has the center equal to the point in space.
A fixture is what binds a body and shape together. You can add as many fixtures to a body as you like, and there are built in support for offsetting the shape.

See the samples framework under Downloads for an example on how to attach multiple shapes to a single body.