# totalTorque

> The total amount of torque that has been explicitly applied to this Rigidbody2D since the last physics simulation step.

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public float totalTorque { get; set; }
```

### Remarks

When adding torque to the [Rigidbody2D](/engine/6000.6/script-reference/unityengine/rigidbody2d.md) using [Rigidbody2D.AddTorque](/engine/6000.6/script-reference/unityengine/rigidbody2d/addtorque.md) or [Rigidbody2D.AddForceAtPosition](/engine/6000.6/script-reference/unityengine/rigidbody2d/addforceatposition.md) (when force is applied away from the [Rigidbody2D.worldCenterOfMass](/engine/6000.6/script-reference/unityengine/rigidbody2d/worldcenterofmass.md)) the torque total is summed. When the physics simulation step runs, this total torque is used.

During the next simulation step, the total torque will be time-integrated into the [Rigidbody2D.angularVelocity](/engine/6000.6/script-reference/unityengine/rigidbody2d/angularvelocity.md) then automatically reset to zero.

**NOTE**: Only a [Rigidbody2D](/engine/6000.6/script-reference/unityengine/rigidbody2d.md) with a [Dynamic Body Type](/engine/6000.6/script-reference/unityengine/rigidbodytype2d/dynamic.md) will respond to force or torque. Setting this property on a [Kinematic Body Type](/engine/6000.6/script-reference/unityengine/rigidbodytype2d/kinematic.md) or [Static Body Type](/engine/6000.6/script-reference/unityengine/rigidbodytype2d/static.md) will have no effect.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class Example : MonoBehaviour
{
    void Start()
    {
        // Fetch the rigidbody.
        var body = GetComponent<Rigidbody2D>();

        // Make the assumption the body has no previous torque applied.
        Assert.AreApproximatelyEqual(0.0f, body.totalTorque, Mathf.Epsilon);

        // Initialize a torque.
        var torque = 5f;

        // Add the torque.
        body.AddTorque(torque);

        // The total torque should be what we just added.
        Assert.AreApproximatelyEqual(torque, body.totalTorque, Mathf.Epsilon);

        // Add the same torque again.
        body.AddTorque(torque);

        // The total torque should still be what we've added.
        Assert.AreEqual(torque * 2f, body.totalTorque);

        // We can reset any torque that has been applied since the last simulation step.
        body.totalTorque = 0f;
    }
}
```
