O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - animating our cycles

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.

  1. Open CycleClass_00.py in the Chapter09 folder.
  2. Add this line to our import statements to give us access to Actors:
    from direct.actor.Actor import Actor
    
  3. Scroll down to the setupVarsNPs() method and look for the section where we use if statements to position self.root and load the correct model. That section looks like the following code:
    if(startPos == 1): self.root.setPos(5,0,0) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required