# Introduction to collision in the Physics Core 2D API

> Learn about collisions between 2D physics objects, including collision types, layers, and layer masks.

> **Note:**
>
> This documentation is about writing C# scripts using the `Unity.U2D.Physics` API. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to [2D physics](/engine/6000.6/manual/unity2d/2d-physics.md.md) instead.

In Unity, a collision happens when two objects occupy the same physical space.

To detect collision between Physics Core 2D API objects, Unity uses the `PhysicsShape` objects attached to the `PhysicsBody`. The shape defines the physics body for the purposes of physical collisions. The shape is similar to the Collider 2D component in the regular [2D physics](/engine/6000.6/manual/unity2d/2d-physics.md) system.

Shapes don't need to be the same shape as the body, and you can add multiple shapes to one body.

For more information about adding a shape, refer to [Create a physics object](/engine/6000.6/manual/unity2d/2d-physics-api/create-objects/physics-object.md).

## Collision types

In the Physics Core 2D API, collisions are enabled by default.

How a shape reacts to collisions depends on its type:

* Collider: The shape can't enter other objects. When the shape makes contact with another shape, it reports a contact event. This is the default.
* Trigger: The shape goes through other objects. When the shape enters another shape, it reports a trigger event.

For more information, refer to [Configure collisions between Physics Core 2D API objects](/engine/6000.6/manual/unity2d/2d-physics-api/interactions/collisions-enable.md).

To detect collisions and overlaps using callbacks or events, refer to [Detect collisions between objects](/engine/6000.6/manual/unity2d/2d-physics-api/interactions/collision-handle.md).

## Collision layers

Unity uses layers to determine which objects collide with each other.

By default the following applies:

* Objects use [GameObject layers](/engine/6000.6/manual/working-with-gameobjects/layers.md), and all objects are on the built-in layer called **Default**.
* Objects collide with objects on all other layers.

To change this behavior, change the layers that objects are on, and the layers they collide with. For more information, refer to [Configure collisions between 2D physics objects](/engine/6000.6/manual/unity2d/2d-physics-api/interactions/collisions-enable.md).

In the Physics Core 2D API, you can use a different set of 64 layers, instead of the standard set of 32 GameObject layers. For more information, refer to [Use up to 64 layers](/engine/6000.6/manual/unity2d/2d-physics-api/interactions/collisions-enable.md#use-up-to-64-layers).

## Additional resources

* [Check Physics Core 2D API interactions by casting rays](/engine/6000.6/manual/unity2d/2d-physics-api/interactions/raycasting.md)
* [Optimize the Physics Core 2D API with multithreading](/engine/6000.6/manual/unity2d/2d-physics-api/multithreading.md)
