Moving objeck smoothly, exactly one unit

Hello! I am looking fore some input/ideas on how to move an object smoothly one unit.
I will try to explain what i mean;

If you have a 10 unit long road, and hold “forward”, i want the object to float smoothly until you release the button. The challenge i have is to make the object stop at an even unit-number, for example z=9.
THis is simple to do if it wasent going to stop smoothly, but since it is, it sort of have to know what is the closest unit when i release the button, and then ease to that place.
I would also like the object to start smooth. I guess i will have to use the lerp-function, but i am all out of ideas. I appreciate all the help and ideas i can get :slight_smile:

Yes, lerp from one position to another. http://wiki.unity3d.com/index.php/GridMove

–Eric

1 Like

As a non-english; im not sure how to say this without looking rude; but that was exactly what i said. My question is more how i can get it to stop at an even unit-number using the lerp

Read your link, and it looks like it might help a little, thanks

Hmm, seems like this created more problems than i expected. Of course, when the game is waitiong for the ovject to approach the next grid-unit, it feels like the game is lagging, or delayed. Is there anyone who has a good idea to fix this “problem” ?

Try Time.smoothDeltaTime instead of Time.deltaTime