To Camera (Expression Function Reference)
 
 
 

The Function Distance To Camera command in the expression editor inserts the token ctr_dist_cam(<elem1>) at the insertion point in the editing pane. This token returns the distance between the center of an object and the output camera. Replace the dummy argument <elem1> with an object name.

NoteObject names must end in a period.
NoteYou may need to change frames to update the scene if you move the camera interactively.
NoteThis token works only with the output camera. If you have changed the output camera from the default, you may need to force a refresh to see an update; e.g. by changing frames. You can also use To Camera (Expression Function Reference) with the explicit camera name.

Example

ctr_dist_cam(cone.)

Returns the distance between cone and the default camera.