User Tools

Site Tools


public:t-vien-12-1:lab_3_materials

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:t-vien-12-1:lab_3_materials [2012/01/24 21:30]
hannes created
public:t-vien-12-1:lab_3_materials [2012/01/25 09:55] (current)
hannes
Line 20: Line 20:
 textobject = OnscreenText(pos = (0, -0.9), fg = (1,1,1,1), bg = (0.3, 0.3, 0.3, 0.5),  textobject = OnscreenText(pos = (0, -0.9), fg = (1,1,1,1), bg = (0.3, 0.3, 0.3, 0.5), 
                           align = TextNode.ACenter, scale = 0.07, mayChange = True)                              align = TextNode.ACenter, scale = 0.07, mayChange = True)   
-</code> You can look up the [[http://www.ru.is/kennarar/hannes/useful/PandaManual/OnscreenText.1.html|various creation parameters]] for **OnscreenText**.  And then any time you want to display some text, just set the ''text'' property for this object.  The following code sets the text to the current camera location values using a [[http://www.ibiblio.org/obp/pyBiblio/tips/wilson/stringFormat.php|python formatted string]] <code python>+</code> You can look up the [[http://www.ru.is/kennarar/hannes/useful/PandaManual/OnscreenText.1.html|various creation parameters]] for **OnscreenText**.  And then any time you want to display some text, just set the ''text'' property for this object.  The following code sets the text to the current camera location values using a [[http://www.diveintopython.net/native_data_types/formatting_strings.html|python formatted string]] <code python>
 textobject.setText("Your location is (%2.2f,%2.2f,%2.2f)" % (base.camera.getX(), base.camera.getY(), base.camera.getZ())) textobject.setText("Your location is (%2.2f,%2.2f,%2.2f)" % (base.camera.getX(), base.camera.getY(), base.camera.getZ()))
 </code>  Make your label show an updated camera position as you move around. </code>  Make your label show an updated camera position as you move around.
/var/www/ailab/WWW/wiki/data/pages/public/t-vien-12-1/lab_3_materials.txt ยท Last modified: 2012/01/25 09:55 by hannes