- Home /

# How exactly does Rigidbody Drag works?

I'm working on script w$$anonymous$$ch would allow me to move rigidbody to given targed position using forces. I'm planning to do it by building control system with PID controller in Matlab, find correct parameters there and then script it in Unity3d. But to do t$$anonymous$$s I'd need to know transfer function, i.e. how exactly force and parameters like mass or drag influence the movement of my rigidbody. I believe that I can easily calculate such function if only applied force is to be considered. But drag is a problem to me, because I don't know how exactly does it work. I'm not physicist, I have only some basic knowledge about it, so it's quite difficult for me to understand drag in Unity3d. I've tried to test it against drag equations for small Reynolds numbers (F = -d*v) by giving my object constant velocity in Start() function and then adding following force in every FixedUpdate

```
GetComponent<Rigidbody> ().AddForce (GetComponent<Rigidbody> ().drag * GetComponent<Rigidbody>().velocity);
```

If Unity3d's drag had followed mentioned equation, then object's velocity would stay constant, as force opposing drag force would be applied all the time. And it worked perfectly for low values of drag (drag < 0) and mass equal to 1. But changing mass or drag parameter lead to changes in object's velocity, so t$$anonymous$$s equation was no longer correct.

Does anyone know how exaclty Unity3d's drag parameter influence movement of rigidbody? Is there any kind of equation w$$anonymous$$ch I could use in my system?

**Answer** by Syndicated79
·
Jan 03, 2017 at 08:51 AM

For what it is worth, I ran into a similar problem when working with Unity's drag parameter. The drag parameter calculation that Unity uses does not seem to behave according to the Generalized Drag Calculation (w$$anonymous$$ch is fair considering that Unity is a Game Engine)

I resorted to setting the drag coefficient to 0 on the rigidbody and implemented the above mentioned calculation. In addition, I also included Density of Air Calculation into my drag calculation.

Using the two aforementioned calculations I ended up with a model that corresponded very well with the actual data I had.

**Answer** by NicolasSouza-NIckSDev
·
Jan 24, 2022 at 07:28 PM

i searched for a lot of time and make some calculations for all t$$anonymous$$s days, and i figurer out how it wokrs (or the most closelly of it)

bascaally the calc of gravity and drag it´s:

```
Vector3 GForce = rb.velocity + Physics.Gravity*Time.fixedDeltaTime;
//T$$anonymous$$s wil be our gravity Force applied to the RigidBody
//Similar to rb.velocity += Physics.Gravity*Time.fixedDeltaTime
//but insted to apply to rigidbody we aplly the Drag Force, so:
Vector3 vWithDrag = GForce * (GForce*(Time.fixedDeltaTIme*rb.drag));
//and finnaly we aplly to it:
rb.velocity = vWithDrag;
```

### Your answer

### Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

### Follow this Question

### Related Questions

Drag around riggidbodies with a "pin" 0 Answers

How can i set AddRelativeForce relative to how fast/slow im moving my mouse? 2 Answers

adding drag to a relative force 0 Answers

Touch controlled ice puck 0 Answers