Godot Version 4.2.1
I’m making a Character & Camera controller for a platformer and the jump animation is giving me issues. The walk & idle animations work and loop as/when they should. However, when I jump the (jump) animation plays through once then on the second time it just snaps to the (first or last, I’m unsure of which) frame until I hit the ground again, at which it plays the idle or walk depending on horizontal movement. The code to manage the jump as well as my current Animation tree is below
func _physics_process(delta):
# Add the gravity. Plays Jump
if not is_on_floor():
velocity.y -= gravity * delta
anim_tree.set("parameters/Jump/blend_amount", 1)
else:
anim_tree.set("parameters/Jump/blend_amount", 0)
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
anim_tree.set("parameters/Run/blend_position", velocity.length() / SPEED)