distance dividing problem

I have two objects. one is shooting a ray at the second one.

var obj1:Transform;
var obj2:Transform;
var directionToTheTarget:Vector3;

var cube:Transform;//prefab

function Update () {
    if(Input.GetKeyDown(KeyCode.Space)){
        directionToTheTarget = obj2.position - obj1.position;
        var hit:RaycastHit;
        if(Physics.Raycast(obj1.position, directionToTheTarget*100, hit)){
            print("distance = " + hit.distance);
        }
    }
    Debug.DrawRay (obj1.position, directionToTheTarget* 100, Color.green);
}

if it succeeds, what I imagine is it could create about X objects (prefabs) (let's say: 3, for example) in between those points, divided equally, but I guess I don't know how to find the positions of these in-between places hmmm...

Something like this:

var spacing = directionToTheTarget / (numObjects + 1);

for (var i = 1; i <= numObjects; ++i)
{
    Instantiate(prefab, obj1.pos + spacing * i, Quaternion.identity);
}

should space the objects evenly between the two points, not putting the prefab on the start or end