Collision Polygon Extractor

local processing
Trace a sprite’s transparent edge into collision shapes: a simplified outline, convex pieces for physics engines, a convex hull or a box. Export Godot, Unity, Phaser / Matter, SVG or JSON coordinates. Runs locally in your browser.

Collision Polygon Extractor

What it is

Physics engines need a shape that matches a sprite, and drawing it by hand is slow. This tool thresholds the sprite’s alpha channel, traces the exact pixel boundary of every island and hole, simplifies it with the Ramer–Douglas–Peucker algorithm to as few points as your tolerance allows, and then either keeps the outline, splits it into convex pieces (ear clipping with hole bridging, then Hertel–Mehlhorn merging under a vertex limit), or reduces it to a convex hull or a box.

When to use it

Use it for platformer and top-down characters, props, destructible chunks and any irregular sprite. Choose convex pieces for Box2D-style engines, which need convex shapes with a vertex cap, or the plain outline for engines that triangulate concave polygons themselves. Set the origin and pixels-per-unit to match how your engine places the sprite, then paste the code.

Gotchas & limits

Holes are kept in the outline mode and in the Unity and SVG exports, but most 2D physics engines cannot represent a hole, and convex pieces fill them in only when the hole is bridged cleanly. A higher tolerance means fewer points and a looser fit, so test fast-moving objects. Semi-transparent glow around a sprite counts as solid when its alpha is above the threshold. Images are limited to 2048 px on the longest side.