godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.06k stars 21.18k forks source link

Animation_begin emitter not working as expected #39160

Open lukostello opened 4 years ago

lukostello commented 4 years ago

Godot version:

3.2.1 stable

OS/device including version:

Windows10

Issue description:

I am trying to use Animation player to go from 2 - 2.5 then -.5 to 0 using animation player and it keeps inserting a frame where it has a value of .5.

I could forgive the behavior of this if I was changing the value when the animation_finished signal emitted out of my "begin" animation (which I tried there is an alternate script you can attach to the tracker object using this method) but I am changing it at the beginning of the "end" animation. This behavior is not what I want and I don't know how to get my desired effect.

Steps to reproduce: just hit play. You'll see it appear at .5 and you'll be able to read it on the print out as well.

Minimal reproduction project:

wrap problem.zip

tom-jk commented 4 years ago

As a workaround try the animation player advance or seek methods:

func anim_begin(anim_name):
    if(anim_name == "end"):
        translation.x = 0
        anim_player.advance(0)
        # or: anim_player.seek(0, true)

this seems to force it to update immediately, which makes the box move straight to the intended position.