Make 2d Balls follow one another

Hi guys,
I am trying to instantiate a row of balls. I want to instantiate them one after the other and launch them in the same direction and make them follow one another. the idea is than when the first one bounces of a wall the others should follow its trajectory, so the same path but with a slight delay. I can’t seem to get it working.

I apply a force to the first one, deactivate the others’ rigidbodies and try to make them follow it or the one in front of each one but i can’t get it to work. launching them with rigidbodies in the same direction but with a delay almost works, but if they encounter moving objects they each bounce off in a particular direction. I need them to move in a single file.

Does anyone have an idea, please?? I am not asking for code necessarily, but at least an idea or a logic.

This can be done in a few ways depending on exactly how you want it. One way would be give each ball a reference to the ball it is behind. And then have each ball lerp/interpolate to the location of the ball in-front of it. Something like this:

public Transform BallToFollow;
public float LerpScale=1f;
void Update()
{
    transform.position = Vector3.Lerp(transform.position, BallToFollow.position, LerpScale * Time.deltaTime);
}

Where you will need to just pass in to each ball the ball it should be following. So the ball in front won’t have this script, ball 2 will have a reference to the ball in front, 3 will have a reference to 2 etc…
Then disable the rigidbodies on all the trail balls, they shouldn’t even need them

If you need a solution that perfectly follows the balls in front, take a look at Casper-Chimp’s answer, it uses the same principle, but instead of lerping uses queues to match the leading ball’'s location perfectly!

To follow the exact path of the leading object you can store the positions in a queu, where the size of the queu determines the distance behind the object. You can use it like the other script to chain objects together so each object just follows the one in front of it.

    public GameObject objectToFollow;
    public int stepsBehind;
    private Queue<Vector3> positions;
	// Use this for initialization
	void Start () {
        positions = new Queue<Vector3>();
        for(int i=0;i<stepsBehind;i++)
        {
            positions.Enqueue(transform.position);
        }
    }
	void FixedUpdate () {
        positions.Enqueue(objectToFollow.transform.position);
        transform.position = positions.Dequeue();
    }