# Collision layers

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

Up to 32 named layers and the pairs that collide are declared in `project.aego` or in Project Settings → Physics:

    physics {
      layers=[Default, Ground, Player, Enemy]
      collide {
        Player=[Ground, Enemy]
        Enemy=[Ground, Player]
      }
    }

The matrix is symmetric: `Player=[Enemy]` also lets enemies hit players. Without a `collide` block every layer collides with every other. An unknown layer name in `collide` is a load error.

A body stores its layer as an index, so renaming a layer keeps every body on it; clearing a name keeps the index. Two shapes collide when both bodies' `Mask` accept the other's layer and the matrix allows the pair. Changing a layer or mask during Play ends the contacts it forbids in the next step.
