Godot 3.2.
Update
Doing print(anim_player.get_current_animation())
prints nothing, so I'm led to believe that the current animation is somehow ending up being null - but strangely, the correct animation plays in-game when I trigger it, and there are no console errors.
I think the issue may be to do with the fact that I'm triggering the animation through an AnimationNodeStateMachinePlayback
, so even though it refers to an AnimationPlayer
's animation, the AnimationPlayer
isn't actually "playing" it itself, so its current animation ends up being null.
Original Question
I am trying to set up an animation that I need to pause until some input is received, at which point it resumes. (Specifically I want to charge up for a big jump, which involves crouching, holding the crouch position to charge up, and then jumping).
I know I could do this by having separate animations for each part of the overall animation, but to me, this seems silly when it should be possible to have one animation and step through it.
What I've tried so far doesn't give me the desired effect, or does nothing at all.
In the following examples, I'm pretty sure they're both pointing to the correct nodes, and nothing else is interfering with these attributes.
AnimationPlayer:
anim_player.stop(false) # this is supposedly how to do it according to the docs, but for me it does nothing
anim_player.seek() # gives me an error: E 0:00:01.403 seek: Condition "!playback.current.from" is true.
<C++ Source> scene/animation/animation_player.cpp:1330 @ seek()
anim_player.playback_active = false # does nothing
AnimationTree:
anim_tree.active = false # pauses the animation, but upon setting it back to = true, it starts from the beginning
anim_tree.stop() and anim_tree.start() # also plays from the beginning
anim_tree.process_mode = AnimationTree.ANIMATION_PROCESS_MANUAL # also pauses the animation, but then changing it back to PROCESS_PHYSICS restarts it
I then read about AnimationNodeTimeScale, and I thought that if I set the speed to 0.0 it would pause the animation, but it doesn't seem to do anything, although I couldn't find any examples of how to get access to this node so maybe I referenced it incorrectly.