Multiple Animations Looped in an Order?

Like I’ve mentioned, I’m new to panda3D/Python, and I’m not too sure how blending works either.

I have a model that I would like to loop animations on in order.

There are 3 animations, each labeled ‘anim’ and then their number.

I’d like to be able to play ‘anim1’, then play ‘anim2’, then play ‘anim3’, then have it start all the way from the beginning of anim1.

I have the number of frames for all 3 animations, because I think that might come in handy.

Anybody got any tips? :S

You can use a Sequence of multiple AnimIntervals to get this effect, also see … _Intervals

Ah, thank you very much c:
I will try this & see if it works!

I still don’t understand this very well.

I’ve got this so far:

DanceInterval1 = body.actorInterval(
    loop = (0 or 1),
    startTime = T1,
    endTime = T2,
    loop = (0 or 1),
    startTime =T1,
    endTime =T2,
    loop = (0 or 1),
    startTime =T1,
    endTime =T2,

I don’t know where I’ve messed up. I feel like it’s got something to do with the loop thing and the 0 or 1 :S

I think that I see two problems:

First, you appear to be attempting to place all of your animations into a single interval; instead–if I’m not much mistaken–the correct approach is to create one interval per animation, and then use a Sequence to chain them together.

Second, in terms of Python syntax, you’re missing commas after some of your parameters–the animation names, specifically.

I agree with Thaumaturge. This page shows the code for making a series of actions (Sequence) which are looped (using “.loop()”):

So your code may look something like:

   actorInterval1 = ActorInterval("anim1")
   actorInterval2 = ActorInterval("anim2")
   actorInterval3 = ActorInterval("anim3")
   self.animLoop = Sequence(actorInterval1,

– Ed

BTW, you may have interpreted too literally the syntax in the page that rdb posted. In the manual, “<0 or 1>” means, you can pass either “0” to turn something off, or “1” to turn it on. Your “(0 or 1)” in Python evaluates to “1” since “or” is a keyword :slight_smile:

thank all of you guys
like i said im super new to this so ;u;

i tried it out and now… it’s giving me this?

" File “”, line 50, in
actorInterval1 = ActorInterval(‘anim1’)
NameError: name ‘ActorInterval’ is not defined "

And my code is set up like how you guys showed me (plus just looping of the original animation).


actorInterval1 = ActorInterval('anim1')
actorInterval2 = ActorInterval('anim2')
actorInterval3 = ActorInterval('anim3')

self.animLoop = Sequence(actorInterval1,


( The rest of it is just loading the model & textures, so it has nothing to do with animation. :S )

Might I have forgot to import something, or…?

EDIT: The animations are already loaded in with the model beforehand, ie:

body = Actor ('models/char/suitC-mod.bam', {

Yes, you forgot to import stuff. “NameError” usually means this. Try:

from direct.interval.ActorInterval import ActorInterval

Also, I think I might have been wrong about how to use ActorInterval. Pass in your body too, since that’s the actor that has the animations:

actorInterval1 = ActorInterval(body, 'anim1')  # ... etc 

– Ed

Aha, that did happen to be missing from the imports! Thank you, I probably wouldn’t have guessed that. :stuck_out_tongue:

And it does in fact work! owo
Now I just gotta speed up the animation and it should fit perfectly. :smiley:

Thanks again for all your help!! c: