Aligning boxes rotation to face a object
I am attempting to create a script which will create a row of boxes, going from one point to another(both chosen objects).
The (first) attachment shows what I have at the moment, and the second(manually rotated) shows what I'm trying to get(the reason the boxes aren't inbetween the two boxes, but offset is because the pivot is still in the center, not at the end).
I have managed to get the positions correct, but haven't been able to get proper rotations.
Any help would be appreciated, I have been trying for a while, and havent managed to get a properly working result.
I have also tried using a look at constraint, but haven't been able to transfer the objects rotation to the others, and I don't want to add the constraint to every box.