-
Book Overview & Buying
-
Table Of Contents
Panda3D 1.6 Game Engine Beginner's Guide
By :
To better understand NodePaths, let's go ahead and use the print statement to take a closer look at what's going on.
At the end of the __init__ method in our world class, add this line:
print(self.track)
Make sure it's part of the indented block that makes up the method.

Save the file as "chp02_04.py" and run it. Look at the command prompt window to see the output of the print statement.

Note that at the bottom it says "render/Track.egg" in a format that looks just like a file path. That's because "render/Track.egg" is the model's location in the Scene Graph. Whenever we print out a NodePath, we'll get a result like this.
Next, change the print statement to look like this:

Save the file as "chp02_05.py" and run it.

Now the output says "ModelRoot Track.egg". The ModelRoot is the node that the self.track NodePath points to.
The purpose of this exercise was to better understand the difference between a NodePath and a node. When we...
Change the font size
Change margin width
Change background colour