godotengine / godotengine/godot
Methods not being called at the starting frame of an animation while using AnimationPlayer with default blend time greater than 0.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.2.stable.mono.official [46dc27791]
v4.2.1.stable.mono.official [b09f793f5]
### System information
Godot v4.2.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.4665) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)
Godot v4.2.1.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.4665) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)
### Issue description
I currently have a scene with an animation player, which has a default blend time of 0.1 seconds.
If I set a method execution at the start of an animation, it doesn't get called when the animation plays.

If I set the blend time to 0, the method gets called. I noticed that if the key is set to at least 0.0075 seconds, it does also get called. The problem persists on both immediate and deferred callback mode of the animation player.
This is how I call the animation in the code:
```
animation_player.clear_queue()
animation_player.play("primary_fire")
animation_player.seek(0)
animation_player.queue("idle")
```
### Steps to reproduce
* Create an animation with a method execution at the start.
* Run animation from an animation player with a default blend time greater than 0.
* The method does not get called.
### Minimal reproduction project (MRP)
[FPS Project - MRP.zip](https://github.com/godotengine/godot/files/13997998/FPS.Project.-.MRP.zip)
Go to `res://scenes/weapons/weapon_template.tscn` for the base scene for weapons. The animations you should look at are `primary_fire` and `secondary_fire`. The code for the weapon is in `res://scenes/weapons/weapon_controller.gd`.
Use WASD to move and move the mouse to look. On the left, you can find several weapons laying on the ground. Use E to pick them up. Click the left mouse button to shoot.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the attached MRP and inspect res://scenes/weapons/weapon_template.tscn alongside res://scenes/weapons/weapon_controller.gd, focusing on primary_fire and secondary_fire with a nonzero default blend time. Trace how AnimationPlayer starts a blended animation and handles its method track; done means the method at time zero is called reliably without requiring a small time offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100