# Slow down force/movement

I need to slow down an object when an applied force to its rigidbody stops. I´ve managed to stop that force on time, but then it has like a residual impulse, so it reaches further (much more than is supposed to, like the triple). The only solution that came to my mind was to reduce the impulse´s speed. It worked, but I don´t want that. What I need is to move it very fast and then slow down, with just a little bit of smooth movement after cutting that impulse.

Thanks for your time.

Create a boolean that tells you whether the object is receiving force or not. Then, create 2 scenarios with and if and else statement - where it’s receiving force and where it isn’t; if it’s receiving force, do nothing, if it’s not, add a constant force in the direction opposite of the last direction where you added force which will slow it down until it stops. You will need to record the vector of the force you’re adding every update and reverting the direction is literally multiplying it by -1. If you need the object to have stopping path of constant length for every velocity, then the coefficient with which you’ll be adding the new force with will be dependent on the speed you start slowing down from.

Finally, as it is almost impossible to hit a spot where your speed will be 0, you can calculate how long the stopping path will take. This is simple physics, and I’ve done something similar with my touch to move system in a game, you can see that here:

``````void FindMovementVector (Vector2 location)
{
location -= new Vector2 (gameObject.transform.position.x, gameObject.transform.position.y);
stoppingPath = (charRB.velocity.sqrMagnitude) / (Stats.charAccel * Stats.SlowdownCoefficient * 2);

if(!State.disableFurtherVectoring && location.magnitude > stoppingPath)
InputVector = location.normalized;
else
{
InputVector = Vector2.zero;
State.disableFurtherVectoring = true;
}
}
``````

You can do this with force as well, but you’re going to have to modify the physical equation for it with force instead of like me who used velocity. My equation comes from 2as = v^2, which means that s, or the stopping path is equal to v^2/2a, where a is the acceleration equal to the character acceleration times the character slowdown coefficient (I wanted my character to slow down quicker than it builds speed).

If I understand your wish correctly, the answer is simple:

Add some Drag to the Rigidbody of your gameObject,

Alternatively, you can slow down the velocity of your object over time from within a script.

``````void Update() {
GetComponent<RigidBody>().velocity *= 999f/1000f;
}
``````