# totalForce

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

## Definition

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

```csharp
public Vector2 totalForce { get; set; }
```

### Remarks

When adding force to the [Rigidbody2D](/engine/6000.3/script-reference/unityengine/rigidbody2d.md) using [Rigidbody2D.AddForce](/engine/6000.3/script-reference/unityengine/rigidbody2d/addforce.md), [Rigidbody2D.AddForceAtPosition](/engine/6000.3/script-reference/unityengine/rigidbody2d/addforceatposition.md) or [Rigidbody2D.AddRelativeForce](/engine/6000.3/script-reference/unityengine/rigidbody2d/addrelativeforce.md) the force total is summed. This only applies when using [ForceMode2D.Force](/engine/6000.3/script-reference/unityengine/forcemode2d/force.md) and not when using [ForceMode2D.Impulse](/engine/6000.3/script-reference/unityengine/forcemode2d/impulse.md).

During the next simulation step, the total force will be time-integrated into the [Rigidbody2D.linearVelocity](/engine/6000.3/script-reference/unityengine/rigidbody2d/linearvelocity.md) then automatically reset to [zero](/engine/6000.3/script-reference/unityengine/vector2/zero.md).

**NOTE**: Only a [Rigidbody2D](/engine/6000.3/script-reference/unityengine/rigidbody2d.md) with a [Dynamic Body Type](/engine/6000.3/script-reference/unityengine/rigidbodytype2d/dynamic.md) will respond to force or torque. Setting this property on a [Kinematic Body Type](/engine/6000.3/script-reference/unityengine/rigidbodytype2d/kinematic.md) or [Static Body Type](/engine/6000.3/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 force applied.
        Assert.AreEqual(Vector2.zero, body.totalForce);

        // Initialize a force.
        var force = new Vector2(3f, 2f);

        // Add the force.
        body.AddForce(force);

        // The total force should be what we just added.
        Assert.AreEqual(force, body.totalForce);

        // Add the same force again.
        body.AddForce(force);

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

        // We can reset any force that has been applied since the last simulation step.
        body.totalForce = Vector2.zero;
    }
}
```
