I needed a way to attached a 2d layer in after effects to a 3d layer which was moving in 3d space. Searching online led me to this brilliant little snippet of code which connect the two. Simply alt click the clock next to the position attribute of the 2D layer you want to follow the 3D layer. Then change the "my3DLayer" (only change what's between the quotes) to the name of the 3D layer you wish to match the movement of.
l = thisComp.layer("My3DLayer"); l.toComp(l.anchorPoint);
It works great! Please let me know if you found this useful!