> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/move-a-character-to-an-object.md).

# 将角色移动到对象

连接 Convai Move To 节点，使 AI 控制的角色走向关卡中的 Actor、组件或已编写的移动点。

请使用 `Convai 移动到` 用于将受 AI 控制的角色发送到整个 Actor、某个特定组件，或其编写的某个移动点的节点。本页会端到端连接该节点并确认角色到达。

### 先决条件

* 该角色的 Pawn 由一个 **AI 控制器**.
* 该 Pawn 拥有一个移动组件（例如 `CharacterMovementComponent`).
* 该 AI 控制器具有路径跟随组件。
* 关卡中角色行走的区域已被 NavMesh 覆盖——如果没有，请添加一个 **Nav Mesh Bounds Volume** 如果没有。
* 目标 Actor 已注册——它要么带有一个 `Convai 对象组件`，或者你有一个 `Actor` 可直接传入的引用。

{% hint style="info" %}
`Convai 移动到` 会针对上面每个缺失的前置条件报告一个特定的结果代码—— `缺少 AI 控制器`, `缺少移动组件`, `缺少路径跟随组件`，以及 `缺少导航数据`。请参见 [排查角色移动问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/troubleshoot-character-movement.md) 如果移动失败。
{% endhint %}

### 添加 Convai Move To 节点

{% stepper %}
{% step %}

#### 添加该节点

在角色的 Blueprint 图中（或应触发移动的任何位置），右键单击并搜索 `Convai 移动到`。添加该节点——它属于以下类别 `Convai|Movement`.
{% endstep %}

{% step %}

#### 设置 Moving Actor

将要移动的角色连接到 **正在移动的 Actor**。这必须是满足上述前置条件的 pawn。
{% endstep %}

{% step %}

#### 构建目标位置

**目标** 接受一个 `FConvaiObjectEntry`。展开或构造该条目并设置：

* **Ref** ——要移动到的 Actor。
* **对象是** (`ObjectReference`）— `整个 Actor` ，可让其朝整个 Actor 走去，或者 `特定组件` 用于指定某个命名组件（设置 **组件名称**，并且可选地 **Socket 或骨骼名称**).

如果目标 Actor 的 `Convai 对象组件` 已启用移动点，则它们会自动接管目标解析——角色会走向最近可达的点，而不是对象引用。参见 [编写移动点](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/author-movement-points.md).
{% endstep %}

{% step %}

#### 处理成功和失败

连接两个执行输出：

* **成功** 在以下情况触发： **结果代码** 为 `已到达` 或 `已在目标处`.
* **失败** 会对其他所有结果代码触发。

两个引脚都暴露 **结果代码** 和 **附加说明**. `附加说明` 可以安全地与玩家交流，或输入到角色的上下文中。
{% endstep %}
{% endstepper %}

保留 **锁定 AI 逻辑** （高级显示）处于默认 `false` ，除非此移动是需要完全接管角色移动的复合行为的一部分——锁定它可能会阻止现有的 行为树 运行。

### 验证移动

进入播放模式并触发 `Convai 移动到` 调用。角色应走到解析后的目标位置并触发 **成功** 使用 **结果代码** `已到达`。如果角色已经站在目标位置， **成功** 会立即触发，并带有 `已在目标处` 并且不会发生移动。

{% hint style="success" %}
要准确确认角色解析出的目标位置以及它是否可到达，请打开 [Convai 调试覆盖层](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/troubleshooting/convai-debug-overlay.md) 并查看 **周围环境** 面板中目标对象的条目。
{% endhint %}

### 下一步

{% content-ref url="/pages/b0870b786189af3f53cb07712ed1e14856b726f1" %}
[护送角色](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/escort-a-character.md)
{% endcontent-ref %}

{% content-ref url="/pages/2db1977bcc865a9fcbab486f2c4905551657d9f3" %}
[移动 Blueprint 参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/movement-blueprint-reference.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-movement/move-a-character-to-an-object.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
