docs: update math API docs
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
static Vector2 MoveTowards(const Vector2& current, const Vector2& target, float maxDistance)
|
||||
```
|
||||
|
||||
将当前向量朝目标向量移动指定距离。如果距离已小于 maxDistance,则直接返回目标。
|
||||
将当前向量朝目标向量移动指定距离。如果当前向量与目标向量的距离已小于 maxDistance,则直接返回目标向量。
|
||||
|
||||
**参数:**
|
||||
- `current` - 当前向量
|
||||
@@ -13,6 +13,10 @@ static Vector2 MoveTowards(const Vector2& current, const Vector2& target, float
|
||||
|
||||
**返回:** `Vector2` - 移动后的位置
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**异常:** (无)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
@@ -22,3 +26,8 @@ Vector2 current(0.0f, 0.0f);
|
||||
Vector2 target(10.0f, 0.0f);
|
||||
Vector2 moved = Vector2::MoveTowards(current, target, 3.0f); // (3.0f, 0.0f)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Vector2](vector2.md) - 返回类总览
|
||||
- [Lerp](lerp.md) - 线性插值
|
||||
|
||||
Reference in New Issue
Block a user