Post by Samuele Sabbatini on May 9, 2011 15:22:04 GMT -5
The problem is the variable myskybox! In the function create_skybox you instanciated a general variable myskybox. But in the update_camera function you use a myskybox variable as a class variable because you use self.skybox. So the solution depends on how you want use that variable, so you can add self.myskybox everywhere or remove "self." in the update_camera function.
Post by David Sorrentino on May 10, 2011 4:15:17 GMT -5
First, try to define the variable myskybox as CLASS VARIABLE in this way: def create_skybox(self): ···self.myskybox = loader.loadModel("Models/skybox.egg") # Model filename ···self.myskybox.setScale(200) ···self.myskybox.reparentTo(render) Then, update the position of the skybox within the method update_camera in this way: self.myskybox.setPos(base.camera.getX(), base.camera.getY(), base.camera.getZ())
A class variable is a variable that you can access from every method of the class. You can define a class variable putting the code self. before the variable in question.
I would never die for my beliefs, because I might be wrong...