> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/gou-jian/spawn-areas.md).

# 生成区域

使用生成区域以可视化方式设置生成位置和生成相机位置。

创作者可以设置 **生成位置** 和 **生成相机目标** ，在 Creator Hub 中通过编辑一个 **生成区域** 实体。

这让创作者能够以可视化的方式设置生成区域以及角色生成时所面向的方向，效果与场景中的其他对象相同。

生成区域定义了玩家直接访问你的场景时会出现的位置，无论是通过输入坐标还是传送。你的场景中可能有一些对象会阻挡玩家移动，如果他们恰好生成在这些对象上方，比如树木或楼梯，或者你的场景可能有高低起伏的地形。如果玩家生成在无法移动的物体上方，体验会很差。这就是为什么你可以选择在任意位置设置一个或多个生成点。

{% hint style="warning" %}
**📔 注意**：所有生成点都必须位于构成该场景的地块内。你不能让玩家生成在这些地块空间之外。
{% endhint %}

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-03f89e74cc5e8d88c5b72611a188f78346f24f70%2Fspawn-entity-scene-editor.png?alt=media" alt="" width="200">

生成区域由两个协同工作的不同实体组成：

* **生成** 实体：可在 **玩家** 实体内找到。定义玩家实际的生成点。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-a429daf2399dff521c426b6c93f594134d3d85d1%2Fspawn-entity.png?alt=media" alt="" width="200">

* **相机目标** 实体：可在 **生成区域** 实体。将其移动到玩家生成时希望面向的方向。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-d02cfe4e8573326cce5cccb4dc0fa433943da7dd%2Fspawn-camera-entity.png?alt=media" alt="" width="200">

## 更改生成区域

**生成区域** 及其 **相机目标** 可以像场景中的其他对象一样直接从场景编辑器中移动，或者手动修改其值（与其他实体中的 Transform 类似）。

### 参数

选中生成区域后，创作者可以在组件部分查看并设置以下值：

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-7795398a2f7ea8b1adcbb202a31edb1e1f932569%2Fdefault-spawn-point-component.png?alt=media" alt="" width="600">

* **位置**：角色生成位置。这些是场景内相对于场景原点的坐标，类似于你在 Transform 组件中会使用的坐标。
* **生成相机目标**：相机（以及角色）在进入场景后将面向的方向。利用这一点可以更好地控制玩家进入你的场景时的第一印象。
* **随机化区域**：以米为单位为生成区域增加随机性，并通过 **不随机化** 切换开关进行启用和禁用。启用后，场景编辑器中会渲染一个区域，显示玩家可随机生成的范围。随机偏移同时应用于 X 轴和 Z 轴，并防止所有玩家在生成时彼此重叠，这在拥挤的场景中看起来尤其糟糕。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-c0fa3d111dded3970cfe65fbb2560df57c7f9c74%2Fspawn-point-randomized.png?alt=media" alt="" width="600">

## 多个生成区域

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-f83239964ac95e195a07f435a1abda38a11f2e9a%2Fspawn-area-multiple-scene-editor.png?alt=media" alt="" width="600">

创作者可以定义多个 **生成区域** 。要创建新的生成区域，请按照以下步骤操作：

1. 选择任意一个生成区域， **spawn1** 为默认值。
2. 所有生成区域都会显示在右侧面板中。你可以通过点击 **+ 添加新的生成区域**&#x20;

   <img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-904df69cb6b4e6772b82bd2f5006022a40cc886b%2Fspawn-area-add-new.png?alt=media" alt="图标" width="200">

   .

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-a7d4c514ad3b81c4dd994ba4c7e75b3a6754dc82%2Fspawn-area-multiple-components.png?alt=media" alt="" width="600">

3. 启用 **主生成**&#x20;

   <img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-746d667c0a3c33f23c0b47ab6f2d7cd330309296%2Fspawn-areas-main-spawn-toggle.png?alt=media" alt="图标" width="100">

   &#x20;所需生成区域的。如果有多个生成区域被切换为 **主生成**，玩家将随机出现在其中一个区域。
4. 预览场景。


---

# 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.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/gou-jian/spawn-areas.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.
