# distance to camera as text

I would like to render 3 dimensional text which both includes unchanging text, and automaticly calculated distance to camera (in the units specified under the scene tab), which should look something like this:

is there any way to do this in 2.78, are there any third party add-ons (for Blender 2.78) which allow me to do this or is it possiple to achive this through blender python scripting?

As an example how easy it is to create this with animation nodes, see the node setup below.

Blender file here

• It works just as well as my (text counter plugin) solution, but this feels more general purpose. – Nikolaj Oct 11 '16 at 15:39

Turns out the Text Counter Plugin can be used to solve this problem; this plugin was made to animate text counting up/down, but using drivers it can also display distance to another object (or any property which can be used in drivers really).

After installing the plugin, add text, go to the text tap and find and activate text counter

If desired change »padding« »decimal«, and use suffix and prefix to write what will be before and after the distance displayment.
Then add a driver to counter value

finally go into the graph editor and change type from graph editor to drivers, select the current driver; find »drivers« tap in the disebar to the right, if driver type is not scripted expresion, make it scripted expresion; under variables add new variable (if one does not already exist) change type to distance and as object 1 and 2 select camera and the text.

then change expresion to

var*scale


where var is the name of the distance variable, and the scale is the scale between blender units and the desired units; in this scene i have 100 meters for each blender unit, and i want distance to be displayed as kilometers, therefor my scale is 0.1:

The text now automaticly calculates the distance as the camera and the text moves around the scene.

Unfortunately the suffix and prefix of the text can not be multilined (not even by typing in \n) and only one changing number per text object is supported