Hi everyone. I'm looking for way how to move number tovards value over time. Back in my Unity days I was using Mathf.MoveTowards but I'm unable to find GoDot alternative. I was never good in math so I need little help. Situation is like this : I need to move variable from 0 to 100 within 5 sec but nowhere is written how to do so.

Thanks -Garrom

There is the lerp function. http://docs.godotengine.org/en/3.0/classes/class_@gdscript.html#class-gdscript-lerp

However, this doesn't provide a timer to as to how long you need for for the weight to go from 0 to 1. If you're using physics_process for an object, you can have the weight be myWeight += 1/(60*myTimeInSeconds)


An alternative is the tween node. http://docs.godotengine.org/en/3.0/classes/class_tween.html

Please note though that how it works in Godot 3.0 is kind of a mess at the moment (but it will be cleaned up in Godot 3.1).

4 years later