Make getdistance return maximum value only if the given objects are in different worldspaces (Fixes #1895)