Issue with adding thrust

For a project I am having to have an object fall from the sky and then land on the terrain. When the player presses the space bar thrust is applied to slow the descent.

The problem is I cannot get the thrust to apply smoothly. I have tried setting a variable to contain the gravity and another to contain thrust. The thrust is applied (by combining the negative value of the fall with the positive of the thrust, but then it remains. I need it to only apply the thrust for as long as the space bar is pressed and then have gravity take over again as the thrust is off and acceleration towards the ground continues.

Been trying to work on this for 2 days now and having no luck. Any Ideas or suggestion of where to go to find the relevant information?

Thanks in advance

you should create a coroutine for adding and removing some numbers smoothly

function AddSmooth (ref a,b,speed)
{
if (a < b)
{
while (a<b)
{
a+=speed*Time.deltaTime;
yield;
}
return;
}
else
{
while (a>b)
{
a-=speed*Time.deltaTime;
yield;
}
}
}

then you can have something like this in your Update function

if (Input.GetKeyDown (KeyCode.Space)) AddSmooth (gravity,gravity-thrust,1);
if (Input.GetKeyUp (KeyCode.Space)) AddSmooth (gravity,gravity+thrust,1);