0
$\begingroup$

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:

enter image description here

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?

$\endgroup$
0
$\begingroup$

I would recommend using animation nodes (https://blenderartists.org/forum/showthread.php?350296-Addon-Animation-Nodes)

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

Blender file here

Distance To Object

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

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

adding driver

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.

enter image description here

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.