# PhysicsCallbacks.ITriggerCallback

> An interface that when implemented, can be called as a target by PhysicsWorld.SendTriggerCallbacks.

## Definition

* **Type:** Interface
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public interface PhysicsCallbacks.ITriggerCallback
```

## Remarks

A trigger shape doesn't collide with other shapes. Other shapes pass through it instead. Unity calls `OnTriggerBegin2D` and `OnTriggerEnd2D` on the main thread after the simulation finishes. For a worked example, refer to the `PhysicsShapeTriggerCallback` example in the [Physics Core 2D examples repository](https://github.com/Unity-Technologies/PhysicsExamples2D/tree/master)

Additional Resources: [PhysicsWorld.SendTriggerCallbacks](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld/sendtriggercallbacks.md), [PhysicsCallbacks.IContactCallback](/engine/6000.7/script-reference/unity/u2d/physics/physicscallbacks/icontactcallback.md)

## Examples

```csharp
using UnityEngine;
using Unity.U2D.Physics;

// Add the PhysicsCallbacks.ITriggerCallback interface.
public class DetectTriggerOverlap : MonoBehaviour, PhysicsCallbacks.ITriggerCallback
{
    void Start()
    {
        PhysicsWorld world = PhysicsWorld.defaultWorld;

        // Create a trigger shape that reports overlaps instead of colliding.
        PhysicsBody triggerBody = world.CreateBody(new PhysicsBodyDefinition
        {
            position = new Vector2(0.5f, 8f),
            type = PhysicsBody.BodyType.Dynamic
        });
        PhysicsShape triggerShape = triggerBody.CreateShape(CircleGeometry.defaultGeometry, new PhysicsShapeDefinition
        {
            isTrigger = true,
            triggerEvents = true
        });
        triggerShape.callbackTarget = this;

        // Create a static shape for the trigger to overlap.
        PhysicsBody staticBody = world.CreateBody(new PhysicsBodyDefinition
        {
            position = new Vector2(0f, 0f),
            type = PhysicsBody.BodyType.Static
        });
        staticBody.CreateShape(new CircleGeometry { radius = 3f }, new PhysicsShapeDefinition { triggerEvents = true });
    }

    // Log when the trigger starts overlapping another shape.
    public void OnTriggerBegin2D(PhysicsEvents.TriggerBeginEvent beginEvent)
    {
        Debug.Log("Trigger overlap started.");
    }

    // Log when the trigger stops overlapping another shape.
    public void OnTriggerEnd2D(PhysicsEvents.TriggerEndEvent endEvent)
    {
        Debug.Log("Trigger overlap ended.");
    }
}
```

## Methods

| Method                                                                                                                      | Description                                                                                                                                                                                                                                   |
| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [OnTriggerBegin2D](/engine/6000.7/script-reference/unity/u2d/physics/physicscallbacks/itriggercallback/ontriggerbegin2d.md) | Called when a [PhysicsEvents.TriggerBeginEvent](/engine/6000.7/script-reference/unity/u2d/physics/physicsevents/triggerbeginevent.md) for the object occurs. This will always be called on the main-thread after the simulation has finished. |
| [OnTriggerEnd2D](/engine/6000.7/script-reference/unity/u2d/physics/physicscallbacks/itriggercallback/ontriggerend2d.md)     | Called when a [PhysicsEvents.TriggerEndEvent](/engine/6000.7/script-reference/unity/u2d/physics/physicsevents/triggerendevent.md) for the object occurs. This will always be called on the main-thread after the simulation has finished.     |
