Using Terrains 使用地形

优质
小牛编辑
127浏览
2023-12-01
Desktop

Creating a new Terrain 创建一个新的地形

A new Terrain can be created from Terrain->Create Terrain. This will add a Terrain to your Project and Hierarchy Views.

使用菜单Terrain->Create Terrain可以创建一个新的地形,它将才你的工程视图和层级视图中添加一个地形

Your new Terrain will look like this in the Scene View:

你的新地形在场景中看起来是这样的。


A new Terrain in Scene View 场景视图中的一个新地形。

If you would like a differently sized Terrain, choose Terrain->Set Resolution from the menu bar. There are a number of settings that related to Terrain size which you can change from this dialog.

如果你想要一个不同尺寸的地形,在菜单中选择Terrain->Set Resolution,在弹出的对话框中会有一些关于地形尺寸的设置可供更改。


Setting the resolution of your terrain. 设置地形解析度

On the above image, there are values that can be changed.
These values are:

在上图中,有一些值是可以更改的。这些值包括:

  • Terrain Width: The width of the Terrain in units. 地形宽度:地形的单位宽度。
  • Terrain Height: The height of the Terrain in units. 地形高度:地形的单位高度。
  • Terrain Length: The length of the Terrain in units. 地形长度:地形的单位长度。
  • HeightMap Resolution: The HeightMap resolution for the selected Terrain.
    高度图分辨率:当前选中的地形的高度图分辨率
  • Detail Resolution: The resolution of the map that controls grass and detail meshes. For performance reasons (to save on draw calls) the lower you set this number the better.
    细节分辨率:控制草地和细节模型的地图分辨率,从性能出发(保存绘图调用)这个值越低越好。
  • Control Texture Resolution: The resolution of the splat map used to layer the different textures painted onto the Terrain.
    控制纹理分辨率:用于绘制到地形上混合不同纹理的溅斑贴图的分辨率。
  • Base Texture Resolution: The resolution of the composite texture that is used in place of the splat map at certain distances.
    基础纹理分辨率:在一定的距离用于代替溅斑贴图的复合纹理的分辨率

Navigating the Terrain 地形导航

Terrains work a bit differently than other GameObjects. Most notably, there is no Transform Gizmo that allows you to position the Terrain. Instead, you use Brushes to paint and manipulate your Terrain. If you do want to reposition a Terrain, you can modify its Transform Position values in the Inspector. This allows you to move your Terrain around, but you cannot rotate or scale it.

地形与其他的游戏对象有些不同,比较明显的是,它没有允许你移动位置的变换组件线框。反之,你可以用笔刷来绘制和操作你的地形。如果你想重新定位一个地形,你可以在监视窗中修改它的Transform Position值,它允许你自由移动你的地形,但是你不能旋转或缩放它。

While your Terrain is selected in the Hierarchy, you can gracefully navigate the terrain with the F (focus) key. When you press F, wherever your mouse is positioned will be moved to the center of the Scene View. This allows you to touch up an area, and quickly zoom over to a different area and change something else. If your mouse is not hovering over an area of the Terrain when you press the F key, the entire Terrain will be centered in your Scene View.

当你在层级中选中你的地形,你可以使用F(焦点)键平滑的导航你的地形。当你按下F键,鼠标所在的位置就会移动到场景视图的中心,它能使你快速的缩放选中的区域和切换不同的区域来做修改或其他一些事情,当你的鼠标不在地形的区域上时,按下F键会使整个地形在场景视图中居中。

Editing the Terrain 编辑地形

With the Terrain selected, you can look at the Inspector to see some incredible new Terrain editing tools.

选中地形以后,你可以查看监视窗来找到一些惊艳的新地形编辑工具。


Terrain Editing Tools appear in the Inspector 出现在监视窗中的地形编辑工具。

Each rectangular button is a different Terrain tool. There are tools to change the height, paint splat maps, or attach details like trees or rocks. To use a specific tool, click on it. You will then see a short description of the tool appear in text below the tool buttons.

每个矩形按钮都是一个不同的地形工具,这些工具可以用来地形升降、绘制纹理或附加细节如树或石头等,想要使用某个工具只需直接点击它,你会看到在工具按钮的下方出现一段简介文字。

Most of the tools make use of a brush. Many different brushes are displayed for any tool that uses a brush. To select a brush, just click on it. The currently selected brush will display a preview when you hover the mouse over the terrain, at the size you have specified.

这些工具中大部分以笔刷的形式来使用,使用笔刷的工具会显示出一些不同的笔刷,选择一个笔刷,只需在上面点击即可。当你把鼠标放到地形上的时候当前选中的笔刷工具将会显示一个预览,预览的大小就是你的笔刷大小。

You will use all of these brushes in the Scene View to paint directly onto your Terrain. Simply choose the tool and brush you want, then click & drag on the Terrain to alter it in real-time. To paint height, textures, or decorations, you must have the Terrain selected in the Hierarchy View.

你可以在场景视图中直接使用这些笔刷在你的地形上进行绘制,简单的选择你想要的工具和笔刷,然后在地形上点击并拖动来实时的对地形进行修改。当你想绘制高度、纹理或装饰物时,你必须先层级视图中选中你的地形对象。

Note: When you have a brush selected, move your mouse over the Terrain in the Scene View and press F. This will center the Scene View over the mouse pointer position and automatically zoom in to the Brush Size distance. This is the quickest & easiest way to navigate around your Terrain while creating it.

注意:当你选完一个笔刷时,在场景视图中将你的鼠标移动到地形上然后按下F键,这将会使鼠标指向的位置相对于场景视图居中并自动缩放到笔刷尺寸的合适距离,这是你在创建地形时最快速且最简单的导航方法。

Terrain Keyboard Shortcuts 地形键盘快捷键

While Terrain Inspector is active, those keyboard shortcuts can be used for fast editing (all of them customizable in Unity Preferences):

当地形监视器被激活时,这些键盘快捷键可以用于快速编辑(所有的快捷键都可以在Unity首选项中进行自定义)

  • Shift-Q to Shift-Y selects active terrain tool.
    Shif+Q,Shift+Y选择活动的地形工具
  • Comma (,) and dot (.) cycle through active brush.
    逗号(,)和点号(.) 循环选择笔刷。
  • Shift-comma (<) and Shift-dot (>) cycle through active tree/texture/detail object.
    Shift+逗号(<),Shift+点(>)循环选择活动的树/纹理/细节对象。 ---有点怪
iOS

This feature is currently not available for iOS targets.

此功能目前不支持iOS。

Android

This feature is currently not available for Android targets.

此功能目前不支持Android。

页面最后更新: 2010-09-07