passing frame number between animations

I have different animations on an actor that are the same except for a single body part. I want to change from one animation to the next on the same frame. I tried this, but it just skips the the first frame of the animation as usual:

currentFrame=self.megaman.getCurrentFrame()
#def loop(self, animName, restart=1, partName=None,fromFrame=None, toFrame=None)

if self.status[1]:
     if currentAnim != 'RUN': self.megaman.loop('RUN')
                
     if self.status[4] and currentAnim != 'RUNWPN': self.megaman.loop('RUNWPN',0,None,currentFrame)

     if self.status[5] and currentAnim != 'RUNBUSTER': self.megaman.loop('RUNBUSTER',0,None,currentFrame)

Is there another way to achieve this effect? I don’t think animation blending is what I should use.

yes, with a blending between the animations. :smiley:
serious, try it with a animation blending. althought you dont want to use it. :wink:

panda3d.org/manual/index.php/Actor_Animations

or this should work too, just do a animation which inculde all your animations which you want to switch at one frame. most animation tools are such flexible, you can copy paste your animations.

if (bla):
actor.loop('Animation Name', fromFrame = 24, toFrame = 36)
else:
actor.loop('Animation Name', fromFrame = 1, toFrame = 24)

I got it working with half body animations, but the subPart animations don’t play correctly:

          
currentFrame=self.megaman.getCurrentFrame()
self.megaman.loop('RUN', partName='busterArm', fromFrame=currentFrame)

The animation doesn’t play smoothly like a normal loop(‘RUN’), it just jumps back to the first frame, plays to the currentFrame, then jumps back again. I tried restart=0 and restart=1 with no change. I could do a regular self.megaman.loop(‘RUN’, partName=‘busterArm’) but then the animation is out of synchronism with the rest of the animation :cry:

If you do:

loop(fromFrame = xxx)

it means to loop the range of frames fromFrame to the end of the animation. If you want to loop the range of frames over the whole animation, but begin at fromFrame, the command sequence is:

pose(fromFrame)
loop(restart=0)

david

Thanks a lot david! I was messed up by the syntax.