godotengine / godotengine/godot-docs
Interpolation tutorial omits important info on lerp()
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Godot 4.3:**
**Issue description:**
The description and example for Vector2.lerp() makes it seem like the function automatically stops once the weight parameter hits or exceeds 1 or the target parameter is reached, mostly due to the looping gif and the minimalist code example.
I'd suggest at least mentioning that the user needs to actively limit their weight property or otherwise stop the lerp manually.
Suggested changes to the code example:
```
var t = 0.0
func _physics_process(delta):
clamp(t += delta * 0.4, 0, 1)
$Sprite2D.position = $A.position.lerp($B.position, t)
```
or checking if the target position is reached etc. But I feel like clamping t is the most universally applicable way to solve this.
I feel like a lot of the issue stems from the gif with the line "It will produce the following motion:" above it suggesting that there is some kind of automatic stop to the lerp.
This has been mentioned before in [#9674](https://github.com/godotengine/godot-docs/issues/9674) but the person reporting closed it themselves on the same day.
**URL to the documentation page (if already existing):
https://docs.godotengine.org/en/stable/tutorials/math/interpolation.html**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.