Vertex Box2d

Editor for Box2D collision polygons

View project on GitHub

What is Vertex Box2D ?

A simple win32 utility to draw collision polygons for Box2D.

It produces a crude list of the coordinates (both in absolute and relative) ready to be used in your C/C++ code:

// Pivot 0, 0
int elephant[8] = {
167, 307,
313, 183,
455, 368,
256, 364
};

// Pivot 0.000000, 0.000000
float elephant[8] = {
0.185556f, 0.469419f,
0.347778f, 0.279817f,
0.505556f, 0.562691f,
0.284444f, 0.556575f
};

Usage

Drop any PNG file in the window to have the image loaded and ready for editing:

  • To add new points use left mouse button
  • To duplicate points press ALT while selecting one vertex
  • Right button is used to pan around
  • Center wheel allows you to zoom in / out
  • Press BACKSPACE to delete the last vertex entered
  • While selecting a point press DEL to remove it
  • Press SHIFT and the right mouse button to move pivot point
  • Press P to rotate the pivot point to the most common positions

To save your work close the application or load another image. A new file will be created in the same folder of the original image with IMAGE_NAME_coords.txt that will contain the coordinates.

The coordinates will also be copied to the clipboard so you can paste them in your code directly.

The program will look for a coordinates file when opening an image file and load the points so you can continue your previous work.

Contact

Bugs go here

Salut :)
Ric