Hello panda3d community,
Recently I started do scripting and run into problems.
I am trying to do a menue - gui. It has several windows one can choose pressing buttons. How should I organise my code to be able to navigate though the menue tree?
-------------------------OLD QUESTION - SOLVED------------------------------
I am using “carousel” and trying to make the model I load rotate with time around z axis. COuld you help me?
some import
class Menue(DirectObject):
def init(self):
#This code puts the standard title and instruction text on screen
YF19 = loader.loadModel("models/yf19")
YF19.reparentTo(render)
self.startYF19()
YF19.setScale(0.5,0.5,0.5)
YF19.setHpr(self.angledegrees,0,0)
YF19.setPos(1,12,-1)
def startYF19(self):
#Here’s where we actually create the intervals to move the carousel
#The first type of interval we use is one created directly from a NodePath
#This interval tells the NodePath to vary its orientation (hpr) from its
#current value (0,0,0) to (360,0,0) over 20 seconds. Intervals created from
#NodePaths also exist for position, scale, color, and shear
self.modelSpin = self.YF19.hprInterval(20, Vec3(360, 0, 0))
#Once an interval is created, we need to tell it to actually move.
#start() will cause an interval to play once. loop() will tell an interval
#to repeat once it finished. To keep the carousel turning, we use loop()
self.modelSpin.loop()
#We now have everything we need. Make an instance of the class and start
#3D rendering
m = Menue()
run()