Day 18 - CryptoCatch
Today I solved the bug with the animation tree. The problem was that I didn't have an "elif" statement in case the velocity was equal to 0, and I didn't use the ".travel()" method to ensure that the animations don't perform the action at the same time. Here's the updated code:
Before:
if velocity.length() > 0:
animation_tree.set("parameters/idle/blend_position", velocity)
animation_tree.set("parameters/walk/blend_position", velocity)
After:
if velocity.length() > 0:
animation_tree.set("parameters/idle/blend_position", velocity)
animation_tree.set("parameters/walk/blend_position", velocity)
animation_node.travel("walk")
elif velocity.length() == 0:
animation_node.travel("idle")
Problem solved!