1 3D animation transition not blending

Godot Version

4.2.2.stable

Question

I have an couple animations in use for idling (not moving), walking, and running. I have got all of the transitions from one animation to another to work, except for one: running then letting go of the shift key to start walking while continuing to hold down a movement key (wasd)

here is my code for setting the blend times:

animation_player.set_blend_time(“idle”, “walk”, 0.2)
animation_player.set_blend_time(“walk”, “idle”, 0.2)
animation_player.set_blend_time(“run”, “walk”, 0.2)
animation_player.set_blend_time(“walk”, “run”, 0.2)
animation_player.set_blend_time(“run”, “idle”, 0.2)
animation_player.set_blend_time(“idle”, “run”, 0.2)

here is my code to change animations based on action pressed:

var input_dir = Input.get_vector(“left”, “right”, “forward”, “backward”)
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED

	visuals.look_at(direction + position)
	
	if Input.is_action_pressed("sprint"):
		velocity.x *= SPRINT_VELOCITY
		velocity.z *= SPRINT_VELOCITY

		if !sprinting and Input.is_action_pressed("sprint"):
			sprinting = true
			animation_player.play("run")
	
	#and !(Input.is_action_pressed("sprint"))
	elif walking:
		animation_player.play("walk")
		sprinting = false
		
	elif !walking and !(Input.is_action_pressed("sprint")):
		walking = true
		sprinting = false
		animation_player.play("walk")
		
else:
	velocity.x = move_toward(velocity.x, 0, SPEED)
	velocity.z = move_toward(velocity.z, 0, SPEED)
	
	if walking:
		walking = false
		animation_player.play("idle")
	elif sprinting:
		sprinting = false
		animation_player.play("idle")
		velocity.x = direction.x * SPEED
		velocity.z = direction.z * SPEED

the ‘walking’ and ‘sprinting’ variables are used to determine if I am in a walking state or a sprinting state. these are false by default.

to clarify, the animation blends work in any other form (idling to walking, walking to sprinting, idling to sprinting, sprinting to idling, etc), but the only one that isnt blending is sprinting to walking.

i am happy to provide more info if needed.

did you figure out how to fix it im having the exact same problem

@fynncosentino I had the same problem, at first it seemed like all but one blend wasn’t working, but it seems to be just the time management, try drastically changing the blending values, for example if in the blending that looks like is not working, if the time is set to 0.6 change it to 100.6 and see if it’s working. From what I see the blending process keep running all triggered animations for the defined time even though you’ve already changed to another one, and they can affect the other blending. I’m new to godot so I don’t know if there’s a way to clear blending animation cache when you trigger a new one, but for now a fine tuning was all I needed