You could first convert the position of the object to global, and then back to local, using to_global
and to_local
functions of Node2D
.
For example:
var global_pos = nodeA.to_global(position_local_to_nodeA)
var position_local_to_nodeB = nodeB.to_local(global_pos)
If you can't get the global position I'm not sure what you could do. Because you really need to know which transformation to apply to convert from "local to node A" to "local to node B", and that can't work if you don't have that information. Sounds like you need to untangle that problem first. Maybe change your structure or the way information is passed around.