All Questions


John Croisant

Setting animation player playback speed has no effect

As of Godot 3.1 and 3.2, setting playback_speed on the AnimationPlayer will have no effect. Apparently the AnimationTree overrides the AnimationPlayer's playback_speed. See bug #22417.

Here is how I worked around it by using a BlendTree node in the AnimationTree state machine:

  1. Edit the AnimationTree's state machine.
  2. Delete the old "move_ground" node.
  3. Add a new BlendTree node and name it "move_ground". Set up the connections with the "idle" and "jump" nodes like before.
  4. Edit the BlendTree, add a new BlendSpace1D node, which I named "blend_walk_run". Edit it to configure the blending between walk and run animations, just like in the earlier video. Basically you are recreating the old "move_ground" node inside the BlendTree.
  5. Inside the BlendTree again, add a TimeScale node. I named it "walk_run_speed".
  6. Click and drag the dots to connect the right side of "blend_walk_run" node to the left side of "walk_run_speed" node, and then from the right side of "walk_run_speed" node to the left side of "output" node.
  7. In, in func set_move_direction, update the path to set the blend position, because we added a new level in the node hierarchy: animation_tree["parameters/move_ground/blend_walk_run/blend_position"] = direction.length()
  8. In func set_playback_speed, instead of animation_player.playback_speed = speed, do this: animation_tree["parameters/move_ground/walk_run_speed/scale"] = speed

I hope this helps anyone who was confused about why the animation didn't actually change speed! :)

  • Nathan Lovato replied

    Thanks for sharing!

    I don't recall having issues personally, and the video was recorded in Godot 3.2. But it's been months so I can't say for sure.

    Anyway, you sharing your solution is much appreciated.