It sounds like you're trying to accomplish what I demonstrated in my last two tutorials:
Tracking a Child in After Effects.
To track the position of a child layer (layer 2), use this expression on the layer you want to effect (the effect position on Layer 1).
L = thisComp.layer(”child_layer”);
P = L.toWorld(L.anchorPoint);
where P[0] gives x, P[1] gives y, and P[2] gives z.
Carl Larsen
TelescopeMediaGroup.net