Godot Version
4.3
Question
Hi, I’m new to Godot and GameDev, so I’m missing a lot of knowledge, but: I’m trying a make smooth animation for aiming using blend. I have reached solution, but I really don’t like it.
Simplified example:
-
Animations are non repeating rotation of 45° “tilt to left” and “tilt to right”
-
This is my Animation tree:
-
I’m stepping 15° with attempting smooth transition between steps
-
Just setting up the blend will result in animation playing only once for each direction:
- setting animation on repeat jut makes it bounce constantly.
-
I have solved this by updating the blend value continuously by code, where current_position is set as the blend value
elapsed_delta += delta
current_position = lerpf(
current_position,
destination_position,
# min to cap if delta is to big (for example clicking out of window in middle of animation)
min(animation_step * elapsed_delta, abs(destination_position - current_position))
)
- result:
I believe THIS is ugly solution and there has to be something that I’m missing, but I looked everywhere I could think of and found nothing.