Hey Folks 
I’d like an objekt move inbetween 4 positions I had a look in the forums and stuff and I came up with this:
// position switch variable
var count = 0;
// positions
var endPoint : Vector3;
var endPoint1 : Vector3;
var endPoint2 : Vector3;
var duration : float = 1.0;
private var startPoint : Vector3;
private var startTime : float;
startPoint = transform.position;
startTime = Time.time;
function Update () {
// keys to change variable
if(Input.GetButtonDown("Fire1"))
{
count += 1;
}
if(Input.GetButtonDown("Fire2"))
{
count -= 1;
}
// the different positions
if ( count < 1)
{
transform.position = Vector3.Lerp(startPoint, startPoint,(Time.time - startTime) / duration);
Debug.Log("Start Position");
}
if ( count == 1)
{
transform.position = Vector3.Lerp(startPoint, endPoint,(Time.time - startTime) / duration);
Debug.Log("First Position");
}
if ( count == 2)
{
transform.position = Vector3.Lerp(startPoint, endPoint1,(Time.time - startTime) / duration);
Debug.Log("Second Position");
}
if ( count > 2)
{
transform.position = Vector3.Lerp(startPoint, endPoint2,(Time.time - startTime) / duration);
Debug.Log("Third Position");
}
}
Now the problem is that the object is jumping between the positions rather than “gliding” from one to the next. Do you have any idea how to modify the code?
Thanks a lot!
Dawnreaver
I would go with Time.DeltaTime instead of Time.time. Cool script.
Hey Black Mantis 
Well I didn’ came up with the script on my own. I found parts of it only and modyfied them … probably thats the reason why I don’t fully understand it 
Could you explain what you would change please?
Cheers!
Using Time.time is actually correct but you need to reset the start time each time you do the jump. The reason that the player always jumps abruptly is that Vector3.Lerp expects a parameter between 0 and 1 to interpolate between the start and end positions. If you don’t reset the start time then then the Time.time - startTime calculation will always return a value greater than 1 and so the player jumps immediately to the end position. I’m not entirely sure what kind of control system you are going for here but you probably want something like:-
if(Input.GetButtonDown("Fire1"))
{
count += 1;
startTime = Time.time;
}
// Etc...
Hey Andeeee
Cheers mate! This seems to be the way to go 
Awesome!
I used some of the documentation to help me on that 
First I call the moveToVector3 then after I receive updates from the server,
I use the MoveTo()
var smooth = 5.0;
var target:Vector3;
function Update () {
transform.position = Vector3.Lerp (transform.position, target,Time.deltaTime * smooth);
}
function MoveTo(x:float, y:float, z:float){
target = Vector3(x,y,z);
}
function moveToVector3(pos:Vector3){
target = pos;
}
@see more here : http://unity3d.com/support/documentation/ScriptReference/Vector3.Lerp.html