How to set animation speed using the AnimationTree Node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vnmk8

AnimationTree Node allows blending animations created in AnimationPlayer Node
but I can’t find how to set the speed of the animations and I don’t want to modify animations keyframe by keyframe. I set animations by using eg:

 $animation_tree.["parameters/playback"].travel("Idle")

on process function.

setting the AnimatioPlayer’s playback_speed parameter using

$AnimationPlayer.set_speed_scale(2) 

or

$AnimationPlayer.playback_speed = 2

only changes the speed in editor but not at runtime

how to solve it?

scene

Solved it by adding the StateMachine inside the blendtree and adding a time scale node before the output.

vnmk8 | 2020-11-19 03:48

1 Like
:bust_in_silhouette: Reply From: davidoc

You need to use a BlendTree, inside the BlendTree add your animation and a TimeScale, then in code you can set it with something like

$animation_tree.set("parameters/BlendTree/TimeScale/scale", 2.0)

(Edited the parameters)

I don’t get it? I’m using BlendSpace2D so I can’t set the animation speed there? Design hell

godotuser81293 | 2021-07-17 15:38

You can, when adding a point in the BlendSpace2D select “Add BlendTree” select the point and the button “Open Editor” will open, there tou can add the timescale and your animation

davidoc | 2021-07-17 16:09

1 Like