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

Next revision
Previous revision
public:t-vien-12-1:lab_3_materials [2012/01/24 21:30] – created hannespublic:t-vien-12-1:lab_3_materials [2024/04/29 13:33] (current) – external edit 127.0.0.1
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/cadia.ru.is/wiki/data/attic/public/t-vien-12-1/lab_3_materials.1327440649.txt.gz · Last modified: 2024/04/29 13:33 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki