We're going to add two kinds of animation to our cycle. We'll make the discs at the front and rear of the cycle rotate in accordance with the throttle setting, and we'll make the cycle lean left and right when it turns. Because we don't want the CollisionRays
attached to the cycle to lean as well, we'll have to make accommodations for that.
Open
CycleClass_00.py
in theChapter09
folder.Add this line to our
import
statements to give us access toActors
:from direct.actor.Actor import Actor
Scroll down to the
setupVarsNPs()
method and look for the section where we useif
statements to positionself.root
and load the correct model. That section looks like the following code:if(startPos == 1): self.root.setPos(5,0,0) self.cycle = loader.loadModel("../Models/RedCycle.bam") elif(startPos == 2): self.root.setPos(-5,-5,0) self.cycle = loader.loadModel("../Models/BlueCycle.bam") elif(startPos == 3): self.root.setPos(5,...