> 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/gaze-attention/gaze-attention-quick-start.md).

# 注视注意力快速开始

在 Convai Player Component 上启用注视注意力，并验证当玩家注视带标签的世界对象时角色会作出响应。

在……上启用凝视注意力 `UConvaiPlayerComponent`，将一个世界 Actor 标记出来，使其能够接收注意力，并验证当玩家将视线停留在该对象上后，Convai 角色会识别该对象。到最后，当玩家将视线看向该 Actor 持续 `GazeAttentionDelay` 持续时间（默认：1.0 秒）。

{% embed url="<https://youtu.be/Ffkzgof_wKw>" %}
Convai 注意力操作演练
{% endembed %}

### 前置条件

在启用凝视注意力之前，请确认以下内容：

* Convai Unreal Engine 插件已安装并且 API 密钥已配置。另请参见 [安装 Convai 插件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/install-the-convai-plugin.md).
* 你的关卡包含一个 `UConvaiChatbotComponent` AI 角色上有一个 `UConvaiPlayerComponent` 玩家 Pawn 上有一个有效的 `CharacterID` 以及一个正常工作的麦克风会话。
* **启用操作** 已在聊天机器人上勾选。请选择聊天机器人，在 **大纲**，打开 `UConvaiChatbotComponent` ，位于 **Details** 面板，展开 **Convai | 操作** → **Environment**，并确认 **启用操作** (`bEnableActions`）已开启。凝视注意力会将数据写入聊天机器人的注意力槽，这要求在会话连接时操作系统处于激活状态。如果尚未设置操作，请遵循 [角色动作快速入门](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-actions/character-actions-quick-start.md) 。

{% hint style="info" %}
如果你还没有标记任何世界对象，请先完成 [场景元数据快速开始](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/scene-metadata/scene-metadata-quick-start.md) 后再继续。凝视注意力至少需要一个 `UConvaiObjectComponent` 且具有非空的 **名称**.
{% endhint %}

### 先启用凝视注意力并标记一个对象

{% stepper %}
{% step %}

#### 选择玩家 Pawn

在 **大纲** （或 **内容浏览器**，如果正在编辑蓝图），打开包含 `UConvaiPlayerComponent`.
{% endstep %}

{% step %}

#### 打开主开关

选择 `UConvaiPlayerComponent` ，位于 **Details** 面板。在 **Convai | 凝视注意力**，勾选 **启用凝视注意力** (`bEnableGazeAttention`）。默认值为 `false`；在启用此项之前，其余所有凝视设置都会保持灰显。
{% endstep %}

{% step %}

#### 设置响应模式

设置 **凝视应响应** (`GazeShouldRespond`）为 `始终`。默认值为 `从不`，这会在不请求角色口头回复的情况下，静默更新注意力槽。

在 **凝视注意力文本** (`GazeAttentionText`），输入一句简短的话，例如 `“玩家正在看着这个对象。”`。Convai 会在注意力提升时将此文本用作叙事事件。
{% endstep %}

{% step %}

#### 标记一个世界 Actor

点击关卡中的任意道具——木箱、门或一件设备。在 **Details** 面板中，点击 **添加组件** 中搜索 **Convai Object Component**。选择它以添加一个 `UConvaiObjectComponent`.

展开 **Convai | 对象** 并设置：

* **名称** ——一个简短标签，例如 `“SafetyValve”`.
* **说明** ——一句话，例如 `“西墙上的一个红色紧急阀门。”`

在 **Convai | 对象 | 凝视**，请确认 **可凝视** (`bGazeable`）已勾选。当 `bGazeable` 是 `false`，该对象将完全从凝视管线中排除。
{% endstep %}

{% step %}

#### 进入游戏模式并看向该对象

按 **播放**。将准星对准已标记的 Actor 并保持不动。

你应该会看到三个阶段的反馈：

1. **立即** ——对象上会出现视觉高亮（UE 5.3+ 为浅黄色覆盖层，UE 5.0–5.2 为线框框），并且中心准星点会变为白色。
2. **在 `GazeAttentionDelay` 秒** （默认 1.0 秒）—— `OnAttentionGained` 触发，聊天机器人的注意力槽会更新。
3. **随后不久** ——角色开始说话，因为 `GazeShouldRespond` 设置为 `始终`.
   {% endstep %}
   {% endstepper %}

{% hint style="success" %}
当凝视注意力正常工作时：只要准星进入对象，立即会出现高亮，准星点会变成白色，并且——在将视线保持 `GazeAttentionDelay` 秒后——角色会开始说出回复。
{% endhint %}

如果高亮始终没有出现，请参见 [排查凝视注意力问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/troubleshoot-gaze-attention.md)。如果高亮出现但角色保持沉默，请确认 **启用操作**, `GazeShouldRespond`，以及 `GazeAttentionText` 在玩家组件上。

### 下一步

{% content-ref url="/pages/d8a57f062e27764c8ec780df8b4e07d5b4d4282b" %}
[注视注意力的工作原理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/how-gaze-attention-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/797ae18ef94bcef2ec7816f079c7a35fb212a26c" %}
[注视注意力参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/2f301cf695f654f0b6dc66672ff9462854021237" %}
[注视注意力使用示例](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-usage-examples.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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-quick-start.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
