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 - loading Actors and Animations

Let's load up an Actor with an animation and start it playing to get a feel for how this works:

  1. Open a blank document in NotePad++ and save it as Anim_01.py in the Chapter09 folder.
  2. We need a few imports to start with. Put these lines at the top of the file:
    import direct.directbase.DirectStart
    from pandac.PandaModules import *
    from direct.actor.Actor import Actor
    
  3. We won't need a lot of code for our class' __init__ method so let's just plow through it here :
    class World: def __init__(self): base.disableMouse() base.camera.setPos(0, -5, 1) self.setupLight() self.kid = Actor("../Models/Kid.egg", {"Walk" : "../Animations/Walk.egg"}) self.kid.reparentTo(render) self.kid.loop("Walk") self.kid.setH(180)  ...

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