Topics / Building a game

Physics

Collider and hitbox

A collider is an invisible shape attached to a game object that says where its edges are for bumping into things. A hitbox is the same idea used for hits and pickups.

Watch: see it in 30 seconds

Video coming soon
A 30-second visual explanation

Why it matters for your game

  • Without colliders, characters walk through walls and nothing can be picked up. With colliders that are too big, they get stuck on corners.
  • The collider is almost never the exact shape of the picture; a box or a circle is faster and usually feels better. Your AI will pick one and you can ask for it to be smaller than the sprite.
  • 'Trigger' colliders detect overlap without blocking: that is how walking onto a doorway loads the next room.

How it comes up when you talk to your AI

  • 'Box collider', 'circle collider', 'capsule' (for standing characters), 'trigger', 'collision layer or mask' (which things can hit which).
  • When something feels wrong on contact, ask to draw the colliders on screen; every engine has a debug toggle for it.

Ask your AI about it

Paste this into the assistant you build with. It is written to get a useful answer for your own project, not a textbook page.

Explain colliders and hitboxes in a 2D game, the difference between a solid collider and a trigger, and why the collider is usually smaller than the sprite. Show me how to turn on the debug view that draws them.

Related terms