# Detect contact between 2D Physics Core objects

> Detect when 2D Physics Core objects make contact, and respond to collision events and trigger events.

To detect contact between 2D Physics Core objects, use either of the following approaches:

* Detect a contact event or trigger event.
* Check whether 2D physics objects overlap or will collide, also known as intersections. For more information, refer to [`PhysicsQuery`](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery.md).

> **Note:**
>
> This documentation is about using Pose, Area, and Constraint components. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to [2D physics](/engine/6000.7/manual/unity2d/2d-physics.md.md) instead.

## Detect contact

To detect when objects make contact, enable Unity reporting collision events or trigger events. Follow these steps:

1. Create a GameObject with a script that implements the [`PhysicsAreaCallbacks.IContactCallback`](https://docs.unity3d.com/Packages/com.unity.2d.physics@latest?subfolder=/api/Unity.U2D.Physics.PhysicsAreaCallbacks.IContactCallback.html) or [`PhysicsAreaCallbacks.ITriggerCallback`](https://docs.unity3d.com/Packages/com.unity.2d.physics@latest?subfolder=/api/Unity.U2D.Physics.PhysicsAreaCallbacks.ITriggerCallback.html) interface, and a callback method. For example:

   ```csharp
   public class DetectCollisions : MonoBehaviour, PhysicsAreaCallbacks.IContactCallback
   {
       public void OnContactBegin2D(PhysicsAreaCallbacks.ContactBeginEvent beginEvent)
       {
           Debug.Log("Contact started between areas: " + beginEvent.areaA + " and " + beginEvent.areaB);
       }
   }
   ```

   For more information, refer to [`PhysicsAreaCallbacks.ContactBeginEvent`](https://docs.unity3d.com/Packages/com.unity.2d.physics@latest?subfolder=/api/Unity.U2D.Physics.PhysicsAreaCallbacks.ContactBeginEvent.html).

2. Select the GameObject you want to detect contact for.

3. In the Editor window, expand the **Definition** section of the Physics Area component.

4. Enable **Contact Events** or **Trigger Events**.

5. In the **Callbacks** section, set **Callback Source** to **Area**.

6. Set **Callback Target** to the GameObject with the script you created in step 1.

If two areas that have either property enabled make contact, they both report the event to Unity.

To run a method or set a parameter you select in the **Inspector** window instead, set **Callback Source** to **Events** and use the properties in the **Event settings** section.

## Additional resources

* [Introduction to collision in 2D Physics Core](/engine/6000.7/manual/unity2d/2d-physics-api/interactions/introduction.md)
* [Configure collisions between 2D Physics Core objects](/engine/6000.7/manual/unity2d/2d-physics-api/interactions/collisions-enable.md)
* [Physics Pose component reference](/engine/6000.7/manual/unity2d/2d-physics-api/create-objects/reference-body.md)
* [Configure global 2D Physics Core settings](/engine/6000.7/manual/unity2d/2d-physics-api/properties/class-physics-core-settings2d.md)
