Expression example: Match camera focal plane to another layer

 Apply the following expression to the Focus Distance property of a camera layer to have its focus distance match the distance to the anchor point of a layer named “target”:
  target = thisComp.layer("target"); 
  V1 = target.toWorld(target.anchorPoint) - toWorld([0,0,0]); 
  V2 = toWorldVec([0,0,1]); 
  dot(V1,V2);