Create Neighbor Terrains 工具用于快速创建自动连接的相邻地形瓦片。在 Terrain Inspector 中,单击 Create Neighbor Terrains 图标。
选择此工具时,Unity 会突出显示所选地形瓦片周围的区域,指示可以在哪些空间内放置新连接的瓦片。
选中 Fill Heightmap Using Neighbors 复选框可使用相邻地形瓦片的高度贴图交叉混合来填充新地形瓦片的高度贴图,从而确保新瓦片边缘的高度与相邻瓦片匹配。
从 Fill Heightmap Address Mode 下拉菜单中选择一个属性以确定如何对相邻瓦片的高度贴图进行交叉混合:
属性 | 描述 |
---|---|
Clamp | Unity 在相邻地形瓦片(与新瓦片共享边框)边缘上的高度之间执行交叉混合。每个地形瓦片最多包含四个相邻瓦片:顶部、底部、左侧和右侧。如果四个相邻空间都没有瓦片,则沿着该相应边框的高度将设为零。 |
Mirror | Unity 会为每个相邻地形瓦片生成镜像,并对这些瓦片的高度贴图进行交叉混合以生成新瓦片的高度贴图。如果四个相邻空间都没有瓦片,则该特定瓦片位置的高度将设为零。 |
要创建新的地形瓦片,请单击现有瓦片旁的任何可用空间。Editor 会在与所选地形相同的组中创建新的地形瓦片,并复制其连接到的瓦片的设置。此外还会创建新的 TerrainData 资源。
默认情况下,Unity 在地形区块的 Terrain Settings 中启用 Auto connect。启用 Auto connect 后,地形系统会自动管理相邻地形区块之间的连接,并且区块会自动连接到具有相同 Grouping ID 的所有邻居。
在极少数情况下,如果更改 Grouping ID__,或者为一个或多个瓦片禁用 Auto connect__,则可能会丢失瓦片之间的连接。要重新创建地形瓦片之间的连接,请单击 Reconnect 按钮。仅当两个相邻的瓦片具有相同的 Grouping ID 以及两个瓦片都启用了 Auto Connect 的情况下,__Reconnect__ 才会连接这两个瓦片。
通过连接一个组中的地形瓦片,可以使用其他工具绘制纹理或以无缝方式调整该组的高度贴图。在运行时,地形系统会自动将所连接瓦片的曲面细分与法线贴图融合。这样可确保它们显示为一块地形而没有接缝或瑕疵。
如果尝试通过一次笔划在两个未连接的区块之间绘制,Unity 会将这些区块视为单独的区块,因此应用的任何效果可能仅显示在一个区块上,或者在每个区块上显示结果不同。
2019–04–17 页面已修订
更新了内容以反映新的 UI 和选项
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.