Topic was automatically imported from the old Question2Answer platform.
Asked By
lowpolygon
I am currently testing out lerp and linear_interpolate for movement.
I know there are other method to move a node,but I am just testing out different stuff.
I notice that there is a slow down as the node close to the destination. Is there a way to do it so the movement speed is the same all the way ?
Alright…I dig a little deeper. This is what I found
timelerped += delta
position = position.linear_interpolate(targetPos,timelerped / timetolerp)
to use this , you do need to know how long you want the obj to move to destination
which is time = distance / speed. It kinda works for what I wanted to do.
Just in case anyone needing this
Using a Tween node is probably more suited in most cases
NOTE: It’s important that you do not use the current position. You need to store your starting position and lerp between that and the target. Lerping from your current position is great for smooth dampening using a constant offset:
position = position.linear_interpolate(target, 0.9)
Thanks , this made a lot of sense to me. I am gonna try it out later. Not by my pc at the moment
You can use the Tween node that is just for this purpose: make one property go from one value to another, within a certain time, and with various transition curves