|Topic was automatically imported from the old Question2Answer platform.
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.
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.
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
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.
have you tried to stop the AnimationTree with
atree.process_mode = AnimationTree.ANIMATION_PROCESS_MANUAL
wich will only advance when advance is called.
klaas | 2020-09-29 10:52
Hi klaas, I did also try that but found that it reset the animation to the beginning. I did it via
set_process_mode() so maybe I’ll try accessing it directly.
Nephtis | 2020-09-29 11:13
have a look here … this seems to solve the issue
klaas | 2020-09-29 11:16
process_mode gave the same result as the other animation tree attempts = the animation paused, but then reset to the beginning when I set
That link uses
seek() which has been giving me a console error; although I do notice that if I do
anim_player.get_current_animation() nothing is returned, so that’s probably where to look for now.
Nephtis | 2020-09-30 05:41