[Answered] Actor.setPlayRate doesn't seem to have any effect

Hi all!

I’m attempting to use setPlayRate to modify the framerate of an animation we have applied to our actor. I’ve tried several variations of the syntax, but they don’t seem to have any effect. For example,


actor.setPlayRate(6.0,"run")

My understanding is that this should play the animation at six times the regular framerate, but it looks exactly the same. Is my syntax wrong?

Thanks,
Mark

Nope, that’s the right syntax. And it still works fine for me. Are you sure you’re not fooling yourself, for instance by calling this on the wrong actor or the wrong animation?

David

If you’re trying to modify the playrate of an animation already in progress, my guess is that it probably won’t work that way. Make sure that you are explicitly calling play, loop, or whichever other animation function after you’ve set the play rate. It’s worked fine for me.

If you need to ratchet up the speed over time, you can get the current frame and restart playback from the same frame; this will of course lose timing some precision between frames for each speed increase. For more accuracy over complicated framerate changes, you should just suck it up and manually set the current frame in an update function.

#make "the tom" fall over
mark.setPlayRate(4.0,'drink')
mark.loop('drink')

Actually, just FYI, it does work this way too–you can adjust the playrate of an animation whether it’s currently playing or not.

David

Found the problem; I was naming the wrong animation.

Thank you for your help!

-Mark