- Home /
Question about addForce()
I've been using unity for quite a while now. And I've noticed that the addForce()
of a rigidbody applies a constant force.
Q1: Can I apply a short force impulse (like box2d's ApplyImpulse
)?
Q2: Can I apply variable acceleration (like a car accelerating)?
Answer by GesterX · May 02, 2011 at 12:35 AM
In addForce you can specify the forcemode as a parameter. So for example:
rigidbody.AddForce (Vector3.up * 10, ForceMode.Impulse);
Some (breif) details of the different forcemodes can be found here:
http://unity3d.com/support/documentation/ScriptReference/ForceMode.html
You can use the same for acceleration.
Edit: Final note - make sure you are doing all of this in FixedUpdate()
Your answer
![](https://koobas.hobune.stream/wayback/20220613130744im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to change velocity of object which move by Rigidbody. 1 Answer
Rigidbody jerky movement? 0 Answers
About Forces and Time.deltaTime 3 Answers
Reuse a collision 0 Answers
How can i set AddRelativeForce relative to how fast/slow im moving my mouse? 2 Answers