Hello. I've been having this issue for a little while and I can't help but feel like there's something simple I'm missing. However, every attempt I've made at fixing it has been unsuccessful. I'm using Godot 4.0 Beta 11, but was having this issue on Beta 10 as well. I have a simple CharacterBody2D with a simple controller. I have a very simple 2 frame run animation, and a 1 frame idle animation. I'm using and animation player and an animation tree. The tree, animations, and character body are all set up as seen below.
extends CharacterBody2D
#movement
const ACCELERATION = 20
const FRICTION = 20
var max_speed = 40
#animation
var direction_facing = 1
@onready var animationPlayer = $AnimationPlayer
@onready var animationTree = $AnimationTree
@onready var skin = $Skin
func _physics_process(delta: float) -> void:
#declare and set input vars
var input_vector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
var input_axis = Input.get_axis("move_left", "move_right")
#handle input and animation tree parameters, change velocity
if input_vector != Vector2.ZERO:
velocity = velocity.move_toward(input_vector * max_speed, ACCELERATION)
animationTree["parameters/MoveState/current"] = 1
animationTree["parameters/TimeScale/scale"] = (velocity.length())
print(str(animationTree["parameters/MoveState/current"]) + " : " + str(animationTree["parameters/MoveState/time"]))
if input_vector == Vector2.ZERO:
velocity = velocity.move_toward(Vector2.ZERO, FRICTION)
animationTree["parameters/MoveState/current"] = 0
move_and_slide()
#flip skin based on aim
if get_global_mouse_position().x < global_position.x:
skin.scale.x = -1
else:
skin.scale.x = 1
Idle Animation

Move Animation

Animation Tree

Transition of Blend Tree Settings

Short Clip of What I'm Talking About:
I've Tried:
- Messing with various inspector properties
- Not using Timescale
- Changing animation lengths
- Changing animation blend types
- Lots of other stuff I'm forgetting (I've tried a lot of things)
I've Noticed:
- Doesn't always happen; I usually have to move around a bit before getting the frame to stick
- Through debugging, I've found that the frame gets stuck only if you stop moving just as the move animation ends, or really close to it ending (at 1 second long, I must stop at exactly 1 second, but at 10 seconds long, I must stop at 9.666667 seconds). This range that determines whether the frame gets stuck or not seems to grow larger the faster the animation plays, whether that's from shortening the animation or increasing the timescale.
- I originally thought that this issue stemmed from the timescale but have found that it still happens regardless of the timescale being there or not, so my best guess is that it's either an issue with how I have my animation player set up, an issue with my animation tree set up, or an issue in my code.
As of yet, I have not tried to replicate this issue in Godot 3.X yet, so it is possibly a bug. Testing it in 3.X is my next step once I get the time. I appreciate any and all help I receive and thank you for your work. I apologize if there are typos or issues with my post. This is my first time posting since the forum changed and it is currently 2:46 am. Again, thank you.