[SOLVED]getCurrentAnimation does not work with ActorInterval

This is part of my code, that I will explain for better understanding:

it’s supposed to play ‘shoot’ animation (by means of an actorInterval) and when it ends, enter the ‘Stand’ state in the finite state machine. Somehow, it seems to do the job, but I tried to improve the code so if the animation is playing, the code won’t run the sequence over. The problem is that getCurrentAnim ALWAYS RETURN NONE and isPlaying returns 0

Unless there is some error in the code, I feel this is one of those things where code should work as it is but actually does not.

def enterShoot(self,world):
        if (world.eric.getCurrentAnim()!="shoot"):
            print world.eric.getCurrentAnim()
            myInt1 = world.eric.actorInterval("shoot",1)
            print myInt1.isPlaying()
            myInt2= Func( self.demand,"Stand",world)
            mySec = Sequence(myInt1,myInt2,name="mySec")
            print world.eric.getCurrentAnim()
            print myInt1.isPlaying()

As You could expect, If using regular play, it does work

            print world.eric.getCurrentAnim()

Someone can help about this?


Right, sorry. getCurrentAnim() doesn’t work with the ActorInterval. This is because when the ActorInterval is running, it’s not actually playing the animation in the conventional sense–it’s just posing the actor to frames.

This deficiency has bugged other people in the past. I guess we need some way to ask the Actor which animation it’s been posed to.


Hmm, bad news. I also tried the workaround mentioned in this thread , but it does not work for me, because


returns 1.0 meaning ‘normal rate’ instead of 24, the supposed animation framerate. I don’t want to force 24 fps in my code, how can I see the actual framerate of the animation?

You want myActor.getFrameRate(‘myAnimation’).


It works! Now I have to make my fsm code not to crash, but that’s another story.

Thanks for your help.