# Translation speed determined by time?

Hello.I know that, by default, transform.Translate moves an object forward along the selected axis one unit every second. I also know that you can modify the amount of space covered by doing something like this: transform.Translate(Vector3.forward *2 * Time.deltaTime).

Is there a way to control the speed of an object through the time it takes to travel a distance? For example, if I specify a transform point (like Vector3(2.5,8,15)), regardless of the space the object and that position, can I move the object to that point in exactly 3.5 seconds?

I hope that makes sense. Thanks

If I understand you correctly, this sounds like a perfect use of iTween’s

It’s a free download and lets you set specific times, among a billion other useful functions and properties.

When you want to go from point A to point B in a given time, the easiest alternative is to use Lerp in a coroutine:

```var moving = false;

function MoveTo(dest: Vector3, duration: float){
if (moving == false){ // only start new MoveTo if the previous has ended
moving = true; // signal that MoveTo has just started
var origin: Vector3 = transform.position; // get origin pos
var t: float = 0;
while (t < 1){ // while object didn't reach end position...
t += Time.deltaTime/duration; // advance t...
// and move object proportionally...
transform.position = Vector3.Lerp(origin, dest, t);
yield; // let Unity free until the next update cycle
}
moving = false;
}
}
```

To move the object to which this script is attached to some position in a given duration, just call:

``````  MoveTo(Vector3(2.5, 8, 15), 3.5);
``````

MoveTo will run in the background, moving the object to the destination in precise 3.5 seconds.