Position of Vector relative to its direction

I have a child object on XZ plane of its parent object. When I rotate the child object around Y-axis, I would like to know its (local) position that is relative to its direction (as if the plane was rotated with it). I need to get negative relative position values as well, not just distance. Here’s an illustration (on XY plane instead of XZ):

82858-graph.jpg

I tried this to find where the lines meet and find the distance of these lines, but they’re always positive.
How could I solve this issue? or is there an even better way I could do this with an integrated function?

Thanks!

Uhm, so you actually want the reverse, get the parent position in the childs local space.

Vector3 parentPosition = child.InverseTransformPoint(child.parent.position);

If you want the childs position in the child space as if the origin is the parent, just negate that vector:

Vector3 childPosition = -parentPosition;