Boxes, boxes everywhere. The only shape a game object could have was a box. Looking at some of the buildings and objects I’m going to be putting into the game, I thought it would be good to add support for arbitrary polygon shapes. With Box2D it should be easy, right?
First thing I had to do was refactor the way objects are added into the Box2D world. This was also a good opportunity to finally change the player and enemy shapes to circles. Sneaking around corners just got a lot smoother.
Second, I had to actually get some shapes. But how? Use the Blender models and generate the shapes by making cross-cuts? While technically an elegant solution, such a tight fit might not be ideal for gameplay.
So I made a shape editor. Each object gets a box by default. Click and drag on any edge to add a new vertex. Right click to remove a vertex. Vertices snap to a grid, holding CTRL turns snapping off for extra precision when needed.