# What is a collision shape?

I am a business developer who is new to game programming. In learning Stencyl, I see that there are things called collision shapes associated with tiles. This seems to be a standard term in game programming. What is a collision shape?

-

A collision shape is the shape of an object as "seen" by the collision/physics engine.

Think of a square box and a circle:

Near the corners, objects will hit or collide with the box but not the circle even though the height and width of the objects are identical.

More complex shapes as also possible. Circles/spheres are the simplest (and fastest) but tend to poorly represent many kinds of objects. Axis-aligned bounding boxes (AABBs) are the next most common/efficient. Capsules (a cylinder with half-spheres on each end) are common for characters. The common collision algorithms all support convex hulls (a polygon/polyhedron with only convex angles), and decent physics engines are typically capable of dealing with objects which have multiple shapes (allowing for objects to incorporate shapes with concave features, even though the collision engines typically can't handle them directly).

Tiles will typically be a simple square AABB fixed to a grid. Specialized collision engines may have direct support for tiles, since a grid-aligned fixed-width AABB is even easier to deal with than arbitrarily positioned/sized AABBs.

-
in your example the circle is the object and the box is the collision shape? – bernie2436 Sep 29 '13 at 2:29
In general, the collision shape is larger than the actual shape. In this answer, the square is the collision shape for the circle. You can have a collision circle too, but it should completely encompass the square in order to make sure that all collisions are handled. – Mokosha Sep 29 '13 at 4:49
The example was just comparing circles with squares and what the differences are between a square of width `X` and a circle with diameter `X`. – Sean Middleditch Sep 29 '13 at 6:57