Thank you very much for that! Currently Im using this code:
%normal = getWords(%building.getTransform(), 0, 2);
%normalN = vectorNormalize(%normal);
%axis = VectorCross(%normalN, "0 0 1");
%angle = mACos(vectorDot(%normalN, "0 0 1"));
%rot = %axis SPC %angle;
// get the world position of the click
%pos = getWords(%building.getTransform(), 0, 2);
// Reposition the building
%building.setTransform(%pos SPC %rot);
The first line I have with the normal just using the position is because the object im trying to align to is a sphere at 0 0 0, so I thought it was safe to assume that the vector from 0 0 0 to the building position would be just the position. My code seems to work fine for the most part but the alignment is a bit off and when a building is closer to the bottom of the sphere it seems to get squished and disfigured. Not sure whats causing that but Ill try using your method above to see if it works better and fixes that issue.