Files
XCSDD/docs/api/math/vector2/movetowards.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

25 lines
578 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Vector2::MoveTowards
```cpp
static Vector2 MoveTowards(const Vector2& current, const Vector2& target, float maxDistance)
```
将当前向量朝目标向量移动指定距离。如果距离已小于 maxDistance则直接返回目标。
**参数:**
- `current` - 当前向量
- `target` - 目标向量
- `maxDistance` - 最大移动距离
**返回:** `Vector2` - 移动后的位置
**复杂度:** O(1)
**示例:**
```cpp
Vector2 current(0.0f, 0.0f);
Vector2 target(10.0f, 0.0f);
Vector2 moved = Vector2::MoveTowards(current, target, 3.0f); // (3.0f, 0.0f)
```