Decreasing velocity of translation?

Hi,

I’m trying to control the velocity of translation from one point to another point of one object, but I don’t know why I can’t. I tried to decrease the amount in the variable I made. But without any result.

any advice is greatly appreciated

Here is my Script

var Speed = 10;
var start : Transform;
var end : Transform;

function Update(){ 
	if(buttonsGUI.onGo ==1){
	 	on();
	 	buttonsGUI.onGo = 0; 	
}
}
 
function on (){   
transform.position = Vector3.Lerp(start.position, end.position,Speed);
}

Well the lerp function interpolates a value from two other values. In your case your asking it to find the position that’s between start and end. You only call it once and, incidentally, you use a value of 10 which is a magnitude greater than the lerp function allows for.

Also, in using a lerp function, the velocity is a function of the distance between the points that you are comparing and the rate at which you interpolate between them. If you were to move a cube over 1m in one second you’d be moving at 1m/s. However, if you’re points were 1000m apart and you still moved it over one second then your effective velocity would be 1000m/s. :slight_smile:

Finally, you’re going to need to Lerp in an Update loop or a coroutine if you want it to move over time, as simply calling your Lerp function once will produce one result!