C#: Move a gameobject from a random location?

Hi
I have a game object that spawns at a random location on the Y axis and moves along the X axis.
Is there any way I could make it move(travel there, not just appear) to a specific XYZ location when it its a certain point on the X axis?

Any help would be greatly apreciated :slight_smile:

http://en.wikipedia.org/wiki/Linear_interpolation

Psuedo-code (to give you the idea):

function start()
{
    timeElapsed = 0
    startPoint = the game object world position
}

function move_to(Vector3 targetPoint)
{
    timeElapsed = 0
    endPoint = targetPoint
}

function update()
{
    if timeElapsed < totalMovementDuration, then
    {
        durationInterval = timeElapsed / totalMovementDuration
        game object world position = linear interpolate (startPoint, endPoint) with durationInterval
    }
    else
    {
        startPoint = the game object world position
    }
    timeElapsed + Time.deltaTime;
}

Unity has Vector3.Lerp() function for linear interpolation, try it out.