#Adding a lerp causes problems
1 messages · Page 1 of 1 (latest)
Animations are better off done with Tweens. It would at least offload a lot of the responsibility here, because it is hard to tell what is even running from all this.
Hi FalseInquisition, how often are these functions running?
Lerp must be done multiple times over multiple frames in order for a smooth movement to happen.
So it's typically called/triggered from _process() or _physics_process(). Perhaps with a timer, state machine, some pattern to control how long it's continued to be called.
Lerp is a function that essentially says "move this initial value towards the target value, by this percentage"
It's important to know, it will never actually reach the target value unless you make that percentage 100 (1.0)
Example:
func _ready():
var my_value = 0.0
var target_value = 10
my_value = lerp(my_value, target_value, 0.1)
print(my_value)
my_value becomes 1.0 which should print 1
"Give me the value that is 10% of the way from 0 to 10"
In lerp(my_value, target_value, 0.1)... The 0.1 is 1/10
If we were change that 0.1 to 0.5, now it would give us the halfway point between 0 and 10. (5.0)
I was definitely being extremely stupid, I forgot to make the animation run every frame so it just ran once and that's it
Oh I'm glad it was an easy fix at least, good luck going forward!