16 · Combat · 2D and 3D

Hitboxes

The invisible shapes the game actually checks for hits.

The game doesn't compare pixels. It checks simple boxes. If the enemy hitbox is bigger than the sprite, players get hit by things that clearly missed and call it unfair. Most good games make the player's hurtbox a bit smaller and their attack box a bit bigger than the art.

←→ moveF or Space attackH show hitboxesTap the scene to attack, ◀ ▶ to move

Try this: Turn hitboxes on, slide to Strict and try to land 3 hits. Then slide to Generous: notice hits that look like misses.

attack boxenemy hitboxyour hurtbox

Hits 0Misses 0Box size 100%

Wait for the slime to come close, then swing.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Separate hitboxes from hurtboxes: enable each attack's hitbox only during its active window (about 0.1 s for a quick slash), test it against the target's hurtboxes rather than the visible sprite or mesh, and remember who this swing already hit so each takes damage once.

45 words · one sentence to paste as is

Where it's used

Common mistakes

Using sprite or mesh bounds as the hitbox, leaving an attack's hitbox on for the whole animation so it hits every frame, and not tracking who was already hit, so one swing deals damage many times.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.