smooth uniform lerp movement

Hey,

i’m trying to get an object to lerp from one point to another in a set time using a liner interpolation (you might have expected that).

here’s the code i’m using:

transform.position = Vector3.Lerp(initPos,
gotoPoint,
speed);

(inital position & goto position)

they’re both stored as temp values and i’ve tried this with Time.deltaTime*speed and i’m not getting a smooth movement.
with the speed at 1 the transition is too quick to notice.
more then 1 is quicker, less then one only brings the object a fraction of the way i.e. 0.5 gets me halfway to the goto position.

i’ve done linear interpolation in maths & physics classes so i know whats going on here and why 1 is instantanious and 0.5 only goes halfway, but i know lerps can be used in unity for fluid movement i just cant see how.

any suggestions?

See here. Also this for some discussion.

try

transform.position = Vector3.Lerp(initPos, gotoPoint, Time.deltaTime);

I assume initPos and gotoPoint are properly initialised.

And obviously this must be called in the Update method.

thanks guys,

got it with a coroutine.
pain in the ass with C#, but it works.