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 - blending two animations

We'll blend two animations together to see how this works.

  1. Open Anim_01.py in the Chapter09 folder.
  2. We need to load a second animation to be able to blend. Change the line where we create our Actor to look like the following code:
    self.kid = Actor("../Models/Kid.egg",
    {"Walk" : "../Animations/Walk.egg",
    "Thoughtful" : "../Animations/Thoughtful.egg"})
    
  3. Now, we just need to add this code above the line where we start looping the Walk animation:
    self.kid.enableBlend()
    self.kid.setControlEffect("Walk", 1)
    self.kid.setControlEffect("Thoughtful", 1)
    
  4. Resave the file as Anim_02.py and run it from the command prompt.

What just happened?

Our Actor is now performing both animations to their full extent at the same time. ...

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