Hi,
yes, few ways to achieve this:
get A position in a vector
get B position in a vector
substract A to B, you get the vector between A and B
even though the positions are expressed in world space, substract A to B gives you the relative position, Are you ok with that?
now youc an do that differently:
get A position
use the action InverseTransformPoint using B as the GameObject and A position as the world positionm, you will get the relative position of A compare to B.
Bye,
Jean