Collision detection – the process of checking to see which game objects have collided with each other.
Once the objects in a game world have physics, they have the ability to collide with one another. Working out the correct way for objects to collide which each other, and what occurs afterwards, is known as collision detection and is another important role of a games engine.
Objects in a game world may have solid colliders surrounding them so that game characters are not able walk through them. These colliders may be the sides of a building, the floor or even invisible walls to stop a player falling off the edge of the game world.
The player’s character will also be surrounded by a collider that detects where their boundary is and stops them from moving through walls.
A game character, whether it is 2D or 3D, has a very complex shape and it would be too taxing on a system to make every part of their body a collider. Instead, a capsule shaped collider is often placed around them which is why, if you are careful, you can sometimes see a character’s arm or leg moving through a solid wall in a game.