image-to-box2d-body
image-to-box2d-body copied to clipboard
proof-of-concept game build pipeline for converting an image to a Box2D body
How to convert drawn images into Box2D objects
This question nerd-sniped me hard, so I went on a magical journey to figure out how to turn a drawn raster image into Box2D objects.
→
this pipeline → 
This proof of concept expects to find an input file input.png in this project
root directory. Then run make.
You should find a bunch of intermediate formats in out/ and if you open
game.html, you should see a Box2D debug view with your objects loaded.
See the makefile for how the build steps work.
Dependencies:
-
make -
Node.js and npm
Run
npm installin the project root directory to download Node.js dependencies to the localnode_modulesdirectory. -
Inkscape
-
potrace
-
ImageMagick (
convertandmogrify)
License
To the extent possible under law, I waive all copyright and related or neighbouring rights to this work.
