- Home /
Acceleration with drag
I use the function AddForce to increase the velocity of an object, but finally the velocity stops increasing because the object has a drag of 1. I can't change the drag, because I need it this way for other functions. Can I use AddForce with drag for simulating acceleration?
Can I use AddForce with drag for simulating acceleration?
I'm confused about what you are asking here.
When you use AddForce with a drag value its speed increases until a limit, and then it stop increasing
Answer by robertbu · Mar 22, 2014 at 04:51 PM
A limit happens in real situations like the terminal velocity of a falling object. To solve:
Add more force
Set or increase velocity directly rather than use AddForce()
Selectively modify the drag value (for example, only apply the drag when the user is not pressing on an acceleration key)
Set the drag to zero and do your own drag calculation.
Something like:
rigidbody.velocity = rigidbody.velocity * 0.985;
This code should be executed in FixedUpdate() and will behave differently from 'Drag'.
Thank you very much for your answer! I tried increasing the velocity directly, but velocity also stops increasing. I can't modify the drag value, but I'd love to know, how could I do drag calculation?
I know there are some velocity limits folks were stumbling over in 2D. Perhaps they also exist in the 3D. The recommendation for 2D was to reduce the scale of everything. As for 'Drag' calculations, that is what the line of code I posted does. There are other, more complex calculations, but try that one first.