Auto Hitbox Generator
Author production 2D collision polygons from sprite alpha. Trace, drag vertices, validate, then export Godot, Unity, Matter.js, Box2D, SVG, or JSON — entirely in your browser.
Trace workspace
Load a sprite, tune the trace, drag vertices — author the collider before export
Sprite
demo_sprite.png
Trace settings
Higher ignores soft anti-aliased edges and glow.
0 keeps every boundary pixel. 1.5–3 suits most sprites.
Negative for a fair player hurtbox, positive for generous pickups.
Unity / Box2D units
Must match Unity Pixels Per Unit (and Box2D pixels-per-meter scale).
No collision polygon yet
Load a PNG with a transparent background, then adjust the alpha threshold until the silhouette is traced.
player_idle.png · 32×32 · RGBA
Vertices
—
From
—
Reduced
—
Coverage
—
Live output
Inspect, validate, and export production collision data
Nothing to author yet
Trace a polygon in the workspace — inspector, validation, and exports appear here.
Templates & examples
Collider presets tuned per role — applied instantly
Professional tips
Only what changes the collider you ship
Simplification
Raise tolerance until the overlay barely drifts from the art, then step back once. Most sprites land at 10–24 vertices with no gameplay difference — physics cost scales with vertex count, not visual fidelity.
Convex vs Concave
Use convex for projectiles, pickups, and anything numerous. Keep concave for terrain and large static props where the silhouette genuinely matters. Engines decompose concave shapes — it is never free.
Physics Optimisation
Ship one stable collider per actor role (hitbox vs hurtbox). Prefer ≤16 vertices for movers, keep pivots matched to your engine import, and clear validation (no self-intersections or tiny edges) before you paste into Godot or Unity.
Professional workflow
Where Auto Hitbox sits in a real 2D production pipeline
Comes in from
Bitmask Autotile GeneratorHands you a bitmask terrain sheet your tilemap can auto-place.
This step · Collision & Physics
Auto Hitbox Generator
Produces a traced collision polygon fitted to your sprite silhouette.
Goes out to
Polygon Collider SimplifierNeeds a traced collision polygon fitted to your sprite silhouette.
Frequently asked questions
How does the tracing work?
Alpha is thresholded into a mask, a Moore-neighbour walk extracts the outer contour, then Ramer–Douglas–Peucker simplifies it. Same sprite and settings always produce the same polygon.
Is my sprite uploaded to a server?
No. Everything runs in your browser tab via FileReader and canvas. Nothing is transmitted.
Can I edit vertices by hand?
Yes. Drag vertices in the workspace. Live Output and exports follow your edits. Changing a trace setting regenerates the polygon and clears manual edits.
Which engines can use the output?
Godot 4, Unity, Matter.js, Box2D, SVG, and JSON. Construct and GameMaker work best via JSON or as a mask reference — see Engine Notes in Live Output.
Why is my collider offset in the engine?
Almost always a pivot mismatch. Match Centre pivot to Godot’s default and to your Unity sprite import pivot, then re-export.
Does it handle holes in the sprite?
No. Only the outer silhouette is traced. Use two colliders or a compound body for donut shapes.
Is the output free to use commercially?
Yes. Generated polygons and scripts are yours with no attribution requirement.