# Detect constraint events

> Detect when the force or torque on a Physics Constraint component exceeds a threshold, using UnityEvents in the Inspector.

To detect when the force or torque on a constraint exceeds a threshold, use the **Callbacks** section of the Physics Constraint component. Unity calls a method or sets a parameter when the constraint exceeds the threshold you set.

> **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.

To detect when a constraint's force or torque exceeds a threshold, follow these steps:

1. Select the GameObject with the Physics Constraint component.
2. In the Editor window, expand **Definition**, expand **Thresholds**, then set **Force Threshold** or **Torque Threshold** to the amount of linear or rotational force that triggers the event.
3. Expand **Callbacks**, then set **Callback Source** to **Events**.
4. Expand **Event settings**.
5. Set **Activation** to control when the event fires: **Editor and Runtime**, or **Runtime Only**.
6. Drag the object you want the event to affect to the **Object** property, or select the picker (**⊙**).
7. From the **Functions** dropdown, select the method to call or the parameter to set on that object.
8. To call more than one method or set more than one parameter, select **Add** (**+**), then repeat the previous two steps.

Unity now calls the method or sets the parameter whenever the constraint's force or torque crosses the threshold you set.

To detect the same event using a script instead of the Inspector, refer to [`PhysicsConstraintCallbacks.IJointThresholdCallback`](https://docs.unity3d.com/Packages/com.unity.2d.physics@latest?subfolder=/api/Unity.U2D.Physics.PhysicsConstraintCallbacks.IJointThresholdCallback.html) or [`PhysicsCallbacks.IJointThresholdCallback`](/engine/6000.7/script-reference/unity/u2d/physics/physicscallbacks/ijointthresholdcallback.md) in the [`U2D.Physics`](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld.md) API.

For more information about the **Callback Source** and **Event settings** properties, refer to a constraint's component reference page, for example [Physics Constraint Distance component reference](/engine/6000.7/manual/unity2d/2d-physics-api/connect-objects/reference-joint-distance.md).

## Verify that an event fired

To check whether a constraint's event fired, expand **Info** > **Callbacks** in the Physics Constraint component, and check the **Joint Threshold** value. This value counts how many times Unity dispatched the event to a valid receiver.

## Additional resources

* [Introduction to constraints](/engine/6000.7/manual/unity2d/2d-physics-api/connect-objects/joints.md)
* [Physics Constraint Distance component reference](/engine/6000.7/manual/unity2d/2d-physics-api/connect-objects/reference-joint-distance.md)
* [Detect contact between 2D Physics Core objects](/engine/6000.7/manual/unity2d/2d-physics-api/interactions/collision-handle.md)
