Now it's time we talk about the Scene Graph. In most game engines, there is a list of what objects need to be rendered and in order for a model or some other element to appear they need to be added to the list. Panda3D uses a similar structure, but instead of a list, we have a tree.
At the root of the tree is render
, which is created for us by DirectStart
. In order for something to appear in the Panda3D window, it needs to be attached to render
. It doesn't have to be directly attached to render
, though. If you attach element A to render
, and attach element B to element A, that's enough. That's why we refer Scene Graph as a tree.
NodePaths
have a specific method used to move them around in the Scene Graph. We've already used it, once.
self.track.reparentTo(render)
The method reparentTo()
makes the NodePath
it's called on a child of the NodePath
it's passed.
In this way we can build a tree of NodePaths
using parent and child relationships. The tree can be as wide and shallow or...