# AddForce(Vector3, ForceMode)

> Applies a force to the ArticulationBody.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public void AddForce(Vector3 force, ForceMode mode)
```

### Parameters

**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): The force vector to apply.**** (\[ForceMode]\(/engine/6000.7/script-reference/unityengine/forcemode)): The type of force to apply.

### Remarks

Note that the force accumulates over the duration of a simulation frame. It is only physically applied to the articulation body during the simulation step, after [FixedUpdate](/engine/6000.7/script-reference/unityengine/playerloop/fixedupdate.md) has been called to scripts. Specifying the [ForceMode](/engine/6000.7/script-reference/unityengine/forcemode.md)`mode` allows the type of force to be changed to an Acceleration, Impulse or Velocity Change.

You can only apply a force to an active ArticulationBody. If a GameObject is inactive, AddForce has no effect. Also, the ArticulationBody must be movable (cannot be immovable).

[ForceMode.Force](/engine/6000.7/script-reference/unityengine/forcemode/force.md) and [ForceMode.Acceleration](/engine/6000.7/script-reference/unityengine/forcemode/acceleration.md) modes modify the Linear Velocity Per Second accumulator and [ForceMode.Impulse](/engine/6000.7/script-reference/unityengine/forcemode/impulse.md) and [ForceMode.VelocityChange](/engine/6000.7/script-reference/unityengine/forcemode/velocitychange.md) modify the Linear Velocity Per Step accumulator. Mixing these 2 groups of ForceModes doesn't work for Articulation Bodies and will result in only the Linear Velocity Per Second accumulator being applied.

For more information on how ForceMode affects velocity, see [Rigidbody.AddForce](/engine/6000.7/script-reference/unityengine/rigidbody/addforce.md).

By default the ArticulationBody's state is set to awake when a force is applied, unless the force is [\_zero](/engine/6000.7/script-reference/unityengine/vector3/zero.md).

Unit of measurement - N (newtons).

This example applies a forward force to the GameObject's ArticulationBody.

Additional Resources: [ArticulationBody.AddForceAtPosition](/engine/6000.7/script-reference/unityengine/articulationbody/addforceatposition.md), [ArticulationBody.AddRelativeForce](/engine/6000.7/script-reference/unityengine/articulationbody/addrelativeforce.md), [ArticulationBody.AddTorque](/engine/6000.7/script-reference/unityengine/articulationbody/addtorque.md)

### Examples

```csharp
using UnityEngine;
using UnityEngine.InputSystem;

public class Example : MonoBehaviour
{
    ArticulationBody m_ArticulationBody;
    public float m_Thrust = 20f;

    void Start()
    {
        //Fetch the ArticulationBody from the GameObject with this script attached
        m_ArticulationBody = GetComponent<ArticulationBody>();
    }

    void FixedUpdate()
    {
        if (Keyboard.current.spaceKey.isPressed)
        {
            //Apply a force to this ArticulationBody in the direction of this GameObject's up-axis
            m_ArticulationBody.AddForce(transform.up * m_Thrust);
        }
    }
}
```
