Loading files into a game is pretty easy with Panda3D, but there are some things to talk about now that we've seen it happen. We'll start by going over the path that Panda3D searches for files, and then we'll talk about a few file types we'll be using.
Panda3D searches a few different places for files when they are loaded, and these locations are controlled by the configuration file. There are a couple default folders in the Panda3D installation directory that are searched, but using them isn't really recommended. The best path to make use of is the most dynamic one, the path to the python file that's being run.
That means that when loading a file, it's best to use a relative path from the file that is launching the Panda3D application. Right now, that file is chp02_03.py
. In that file, we used the path "../Models/Track.egg
" to point to our model file. Our chp02_03.py
file is located in "/BGP3D/Chapter02
" and our model is located in "/BGP3D/Models
"...