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

# 注视与注意力快速开始

使用最少必需组件，为 AI 角色添加眼神接触和自然的头部运动。最终，角色会用眼睛和头部跟随主摄像机，并具有程序化的扫视和眨眼。

### 先决条件

* A `ConvaiCharacter` 该组件位于角色的根 GameObject 上
* 角色使用一个 **人形骨骼绑定** 并配置了 Unity Avatar
* 对于眼球跟踪：该 Avatar 已 **分配了眼骨** （在 Avatar 配置中为左眼 / 右眼）
* 对于 `AnimationRiggingGazeBridge` （可选）：该 `com.unity.animation.rigging` 包已安装，并且 `CONVAI_ANIMATION_RIGGING` 已在你项目的脚本定义符号中定义

***

### 设置

{% stepper %}
{% step %}

#### 添加 ConvaiAttentionController

选择角色的根 GameObject。添加 **ConvaiAttentionController** (**Convai → Embodiment → Attention Controller**).

该组件默认启用了两个选项：

* **在层级中发现提供器** — 自动查找所有 `IFocusTargetProvider` 角色及其子对象上的组件
* **自动创建默认焦点提供器** — 添加一个内置提供器，指向主摄像机（或场景中第一个激活的摄像机）

基础设置下保持两项都启用。组件一激活，角色就会开始跟踪摄像机。
{% endstep %}

{% step %}

#### 添加 ConvaiEyeGazeActuator

在同一个根 GameObject 上，添加 **眼神注视** (**Convai → Embodiment → Eye Gaze**).

眼睛执行器会自动创建一个 `ConvaiGazeCoordinator` 在初始化期间将其创建在同一个 GameObject 上。你无需手动添加该协调器。

{% hint style="warning" %}
不要访问 `ConvaiGazeCoordinator` 来自 `Awake()`。协调器在眼睛执行器初始化期间创建——在……之后才可用 `Awake()` 在角色上完成。请使用 `Start()` 或更晚的时机进行任何脚本访问。
{% endhint %}

可选地，指定一个 `ConvaiGazeEyeProfile` 添加到 **眼部配置文件** 槽位。如果留空，该组件会使用内置默认值（18° 跟踪锐度、45° 偏航范围、30° 俯仰范围，启用扫视和眨眼）。
{% endstep %}

{% step %}

#### 添加 ConvaiHeadLookActuator

在同一个根 GameObject 上，添加 **头部朝向** (**Convai → Embodiment → Head Look**).

可选地分配一个 `ConvaiGazeHeadProfile`。内置默认值：40° 颈部偏航、30° 颈部俯仰、6.0 平滑锐度。

头部执行器通过共享的 `ConvaiGazeCoordinator`。当角色说话时，注视协调配置会将控制权更多转向头部并降低眼睛的贡献，从而形成自然地看向听众的行为。
{% endstep %}

{% step %}

#### 分配一个 Attention Profile（可选）

如果你想调整注意力持续性——角色在移开视线前保持注视多长时间、获取新目标的速度有多快，或最大连续保持时长——请分配一个 `ConvaiAttentionProfile` 添加到 **Attention Profile** 槽位到 `ConvaiAttentionController`.

内置默认值：最长连续保持 5 秒、0.3 秒获取渐变、0.5 秒释放衰减。

通过以下方式创建配置文件： **Create → Convai → Embodiment → Attention Profile**.
{% endstep %}

{% step %}

#### 进入播放模式

按下 Play。默认焦点提供器激活时，角色的眼睛和头部应跟踪 Scene 视图摄像机（或你的主运行时摄像机）。

**预期结果：** 角色的眼睛会以自然的扫视和偶尔的眨眼朝向摄像机移动。当摄像机与眼睛中心偏离超过约 10° 时，头部会平滑旋转以辅助注视。当角色说话时，注视会锁定到摄像机，并略微减小眼部范围。
{% endstep %}
{% endstepper %}

***

### 替代方案：Animation Rigging 集成

如果你的角色使用 Unity 的 Animation Rigging 包，并且你更倾向于使用基于约束的注视而不是程序化骨骼写入，请使用 `AnimationRiggingGazeBridge` 来替代眼睛和头部执行器。

**要求：**

* `com.unity.animation.rigging` 已安装
* `CONVAI_ANIMATION_RIGGING` 已添加到 **Player Settings → Scripting Define Symbols**
* 两条 `MultiAimConstraint` 角色骨架上已为头部和眼睛配置的资源

添加 `AnimationRiggingGazeBridge` 到角色的根 GameObject，并分配头部约束、眼部约束以及一个注视目标枢轴变换。该桥接器会在每一帧将枢轴移动到注意力目标点，然后约束会在动画图的 IK 过程中跟随它。

***

### 下一步

你的角色现在会用眼睛和头部跟踪关注目标。请阅读 Profiles & Tuning 以了解所有可用的调参参数，或阅读 Usage Examples 以获取针对不同场景的配置模式。

{% content-ref url="/pages/5b881c94bd2adefe8b932f255cffe05f31b8cd93" %}
[注意力与注视配置文件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/utilities/gaze-and-attention/profiles-and-tuning.md)
{% endcontent-ref %}

{% content-ref url="/pages/a207c4438cb0378f687867334e1e2e2b5d8c75bb" %}
[注视与注意力使用示例](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/utilities/gaze-and-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 dynamically by asking a question.

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

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/utilities/gaze-and-attention/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
