Collider is a Unity3d component that defines object’s physical collision shape. There are colliders for both 2D and 3D modes.
Colliders are used widely in game development. You probably can’t imagine a game when objects can go through objects, when you can go through the ground and walls, etc.
Each collider type can be applied to a game object.
Unity colliders types for 3D
The most of colliders have pretty simple shape that is mentioned in their names. Here are BoxCollider, CircleCollider and CapsuleCollider:
Box colliders are used to describe phisical collisions for cubic objects like boxes, buildings, etc.
Sphere colliders represents collisions with orbicular objects. In games it is commonly applied to granades, balls, etc.
Capluse is a primitive but useful shape for game characters.
For more complex object’s shape you can combine a bunch of colliders in one object or use MeshCollider wich will inherit the shape of this object.
Unity colliders types for 2D
There are special collider types for 2-dimetional games. In API their names are ended with 2D. They work in the same way as 3D colliders.
BoxCollider2D works similar as a 3-dimentional BoxCollider, except collisions in z-axis. They are commonly used in most of 2D game objects: ground, obsticles, characters bodies, etc.
CircleCollider2D is a flat usage of SphereCollider. It is often used for character’s legs part to be responsible for collisions with the ground.
PoligonCollider2D is similar to MeshCollider. It takes the detailed shape of and object which can be edited to fit the perfect values.
Edge collider is a Unity3d collider type which is used to define object’s edge that should collide with other objects.