oh, I thought you wanted the center of the group of cubes, not the center between the cube and another object.
Oh no you were right, and actually your script works. The red dot is where the current position is, and I was demonstrating how it was on an offset.
oh… lol, ok hope it helps you out