There are several ways of animating things in Panda:
- Creating animation in Maya (or Blender, 3DSMax, etc.), exporting it, and loading it in Panda using Actors
- Using Intervals in Panda to create animation through code
- Using a looping Task in Panda to create dynamic animation and behaviors
For a basic tutorial on animation in Maya, open the Maya Help and open Learning Resources->Tutorials->Animation->Lesson 1 : Keyframes and the Graph Editor
Example: Maya animation and export to Panda
This file has several animated parts - the ball, the horn, the gear, and the antenna. Here, the ball is selected, and its animation curves are shown in the Graph Editor. There are keyframes set at frames 1, 24, and 48 for each of the moving parts.
To make the ball bounce up and down:
- Move the playback head to frame 1
- Select the ball, move it to its starting position on top of the pipe
- Set a keyframe by pressing s on the keyboard
- Move the playback head to frame 48
- Set a keyframe again. This way the last frame will match the first frame.
- Move the playback head to frame 24.
- Set move the ball up, and set a keyframe
Remember you can turn on Auto Keyframe (the little Key Icon in the lower right hand corner of the Maya window) to automatically create keys whenever you move an object. You still have to Set a Key at the first keyframe, though.
Adjust the bounce motion
As in the bouncing ball tutorial, the motion of this ball isn't quite right. Adjust the tangents for the Translate Y property of the ball so that the curve is steep on the right.

- Select the ball
- Select the Translate Y attribute on the left in the Graph Editor
- Select the keyframe you want to change
- Press w to get the Move Tool
- MMB-Drag to move the keyframe if you need to adjust it
- Select the Tangent Handles on the keyframe and
MMB-Drag them to make the curve steeper - If you're editing a keyframe in the middle of the curve, you may want to use the Break Tangents button so you can manipulate them individually
Exporting

To export animation from Maya, you need to change the Export Type in the Panda Export window. There are five options:
- Mesh: the default option, only exports static polygon geometry, no animation data
- Actor: exports geometry which can be animated
- Animation: exports the animation data for an Actor
- Both: exports the Actor and the Animation in one .egg file
- Pose: exports a still pose for an Actor
If you choose "Both", then the egg file will have the model and the animation included. If you use the Actor and Animation options, you can export one egg file with the model, and then one or more egg files with animation sequences.
Loading the animated model in Panda
After exporting, check the model in pview - it should be animating by default.
Here's some simple code to play an animation in Panda. In this example, the model is exported with the "Both" option, so the model and animation are both built into the same file.
from pandac.PandaModules import *
from direct.actor.Actor import Actor
import direct.directbase.DirectStart
base.setBackgroundColor(.8,.8,.8)
light1 = render.attachNewNode (PointLight("light1"))
render.setLight(light1)
light1.setPos(0,-50,20)
base.cam.setPos(0,-50,10)
# load the machine as an Actor instead of a Model, so it can be animated
machine = Actor ("machine1_anim.egg")
machine.reparentTo(render)
# get a list of the animations in the file
anims = machine.getAnimNames()
# and play the first one
machine.loop(anims[0])
run()

