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 - simulating drift

Instead of talking about it all day, let's get the system working and talk about the code once we've finished. Having the examples on hand will help clarify how it all works.

  1. First off, let's import the Vec3 Panda3D class that we'll be using. Add this below the first line of CycleClass_02.py:
    from pandac.PandaModules import Vec3
    
  2. To keep our Cycle class's __init__ method from getting too cluttered, we're going to create a new method to handle some of our set up. Right after the setKey() method, add a new definition that looks like the following line of code:
    def setupVarsNPs(self):
    
  3. To give this new method some purpose right off, move these lines from the __init__ method down into the new method we just defined:

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