The Scene Graph

The scene graph is how Panda3D organizes and keeps track of all the 3D objects you put in your universe! For any Panda3D project, you need to create the 3D scene before you can put anything in it.

from direct.showbase.Showbase import Showbase

class MyApp(Showbase):
    def __init__(self):
        ShowBase.__init__(self)

app = MyApp()

app.run()

In Panda3D, the scene graph is called Showbase, a library you must import in. It allows you to have other 3D objects, but also creates the 3D window to appear. When you call app.run(), the Showbase class will render a frame, handle any background tasks (including the code you write!), and refresh.

Running this code will make a cool 3D gray world appear! Unfortunately, there's nothing in it yet, so go to the next section to learn about adding models to the 3D scene.

results matching ""

    No results matching ""