So, I have a C++ object named Airplane.
It has a pointer to a NodePath with the airplane model and after working on some game logic and inputs it adjusts the position and rotation of the NodePath accordingly.
Right now I am only creating one instance of Airplane and I am passing an externally created NodePath as a parameter of its constructor.
This method is working very well for just one airplane.
I want to be able to create, have, and destroy multiple of these objects during runtime. I would like each one of the instances to create its own nodepath and load its own model upon creation. It might even be better to just load the airplane model once and have every Instance of airplane make a copy of the preloaded model for its NodePath rather than loading it from file every time.
Anyway, I figured that the Airplane class needs its own pointer to the WindowFramework object in order to load models so I made a static member pointer of WindowFramework called Win and I created the following static member function:
if yes then that would be wrong. NodePaths are handles to actual nodes in the panda scenegraph.
They are not pointers. If you didn’t know that I suggest you start with something simpler to understand
how the Panda SDK is supposed to work in C++. Especially if you are new to C++.
your airplane class could look something like this :
(the loading of the model might be a bit wrong (I am sitting at my office desk and haven’t got access to panda right now so I am kind of coding from what I remember)
Panda will load the model the first time arond and for each subsequent load it will try and return and instance of the existing model resource (hence the concept of “handles” ).
about the static member of your class to WindowFramework… that shouldn’t be necessary at all to be honest. But for the sake of it have you included the header of the WindowFramework ?
As I say you shouldn’t need to do this anyway.