Positioning GameObjects 放置游戏对象

Date:2011-08-01

When building your games, you'll place lots of different objects in your game world.

当你建立了游戏,你就要放置许多不同的对象到你的游戏世界中。

Focusing 聚焦

It can be useful to focus the Scene View Camera on an object before manipulating it. Select any GameObject and press the F key. This will center the Scene View and pivot point on the selection. This is also known as Frame Selection.

在场景视图中聚焦一个对象然后操纵它是非常有用的。选择任何游戏对象,然后按F键,场景视图将以所选对象为中心点(并自动调整适当的视角大小),这也称为框选。

Translate, Rotate, and Scale 移动、旋转、缩放

Use the Transform Tools in the Toolbar to Translate, Rotate, and Scale individual GameObjects. Each has a corresponding Gizmo that appears around the selected GameObject in the Scene View. You can use the mouse and manipulate any Gizmo axis to alter the Transform Component of the GameObject, or you can type values directly into the number fields of the Transform Component in the Inspector.

使用工具栏的变换工具可以移动、旋转和缩放游戏对象。每个对象都有一个对应的手柄工具,它出现在场景视图中选定的游戏对象上。你可以使用鼠标操作手柄工具的轴来改变游戏对象的Transform组件,也可以在检视视图中直接为Transform组件的数字字段输入一个值。

移动工具——快捷键“W”    旋转工具——快捷键“E”    缩放工具——快捷键“R”

  • Click and drag in the center of the Gizmo to manipulate the object on all axes at once.
    点击拖动手柄工具的中心,在所有轴向上操作一次对象。
  • If you have a three button mouse, you can click the middle button to adjust the last-adjusted axis (which turns yellow) without clicking directly on it.
    如果你有一个三键鼠标,你可以点击鼠标中键来调整最后调整的轴(即黄色的轴),而不用点击(鼠标左键点击)该轴。
  • Be careful when using the scaling tool, as non-uniform scales (e.g. 1,2,1) can cause unusual scaling of child objects.
    小心使用缩放工具,如果是非均匀的缩放比例(例如1,2,1)则会导致子对象的比例失衡。
  • For more information on transforming GameObjects, please view the Transform Component page.
    如需变换游戏对象的更多信息,请查看Transform Component页面。

Gizmo Display Toggles 手柄工具显示切换器

The Gizmo Display Toggles are used to define the location of any Transform Gizmo.

手柄工具的显示切换器用来限定Transform手柄工具的位置。


Gizmo Display Toggles 手柄显示切换器

  • Position 位置:
    • Center will position the Gizmo at the center of the object's rendered bounds.
      Center将在对象范围的中心位置提供手柄工具。
    • Pivot will position the Gizmo at the actual pivot point of a Mesh.
      Pivot将在一个网格的实际轴点位置放置手柄工具。
  • Rotation 旋转:
    • Local will keep the Gizmo's rotation relative to the object's.
      Local将相对于对象保持手柄工具的旋转。
    • Globalwill clamp the Gizmo to world space orientation.
      Global将强制手柄工具为世界空间的方向。

Unit Snapping 捕捉单位

While dragging any Gizmo Axis using the Translate Tool, you can hold the Control key (Command on Mac) to snap to increments defined in the Snap Settings.

当你使用移动工具拖动手柄工具的方向轴时,你可以按住Ctrl键(Mac系统中为Command键),以捕捉在设置中定义的增量。(用过AutoCAD的朋友可能比较容易理解。它的意思是这样的,如果你设置X轴的捕捉间距为1米,那么你在X轴方向的拖动距离只能是整数,而不能拖动1.4米;如果你设置捕捉间距为0.2米,那么一次拖动的距离只能是0.2、0.6这样的整倍增量,而不能拖动0.5米。要注意的是,捕捉只适用于用鼠标拖动时的情况。比如你的捕捉间距设置为1米,而你在Transform组件中输入0.5米,那么该对象的实际移动距离是0.5米;这时你再用鼠标拖动,则该对象的移动距离就是1.5、2.5、3.5……)

You can change the unit distance that is used for the unit snapping using the menu Edit->Snap Settings...

你可以更改该单位,使用菜单Edit->Snap Settings...


Scene View Unit Snapping settings. 捕捉增量设置视图

Surface Snapping

While dragging in the center using the Translate Tool, you can hold Shift and Control (Command on Mac) to snap the object to the intersection of any Collider. This makes precise positioning of objects incredibly fast.

当你使用移动工具拖入中心(什么东西的中心?)时,你可以按住Shift和Ctrl(Mac系统中为Command键)来让对象与任何碰撞体的交叉点对齐。这使得对象的精确定位非常迅速。

Look-At Rotation

While using the Rotate Tool, you can hold Shift and Control (Command on Mac) to rotate the object towards a point on the surface of any Collider. This makes orientation of objects relative to one another simple.

使用旋转工具时,你可以按住Shift和Ctrl(Mac系统中为Command键)旋转对象朝向任何碰撞体表面的一个点。这使得一个对象相对于另一对象的定向变得简单。

Vertex Snapping

You can assemble your worlds more easily with a feature called Vertex Snapping. This feature is a really simple but powerful tool in Unity. It lets you take any vertex from a given mesh and with your mouse place that vertex in the same position as any vertex from any other mesh you choose.

你可以使用一个称为顶点捕捉的特色功能的来组装你的游戏世界。此功能是Unity中一个非常简单而强大的工具。它可以让你把给定的网格顶点,利用鼠标放置到与你选择的其它网格的顶点相同的位置。(原话太长了,读起来有歧义,不知道是不是这个意思)

With this you can assemble your worlds really fast. For example, you can place roads in a racing game with high precision and add power up items on the vertices of a mesh.

利用它你可以快速地组装你的游戏世界。例如,你可以放置赛道在高精度竞速游戏中,并添加动力物品(就是游戏中的各种道具)到一个网格的顶点上。


Assembling roads with Vertex Snapping. 使用顶点捕捉装配赛道

Using vertex snapping in Unity is simple. Just follow these steps:

在Unity中使用顶点捕捉很简单,只需按照下面的步骤:

  • Select the mesh you want to manipulate and make sure the Transform Tool is active.
    选择你想要操作的网格,并确保变换工具处于活动状态。
  • Press and hold the V key to activate the vertex snapping mode.
    按住V键激活顶点捕捉模式。
  • Move your cursor over the vertex on your mesh that you want to use as the pivot point.
    移动你的光标到你想用作轴心的网格顶点上。
  • Hold down the left button once your cursor is over the desired vertex and drag your mesh next to any other vertex on another mesh.
    只要你的光标到了想要的顶点上,按住鼠标左键,拖动你的网格紧贴于另一网格的其他任意顶点。
  • Release your mouse button and the V key when you are happy with the results.
    当你对结果满意时,松开鼠标按键和V键。
  • Shift-V acts as a toggle of this functionality.
    Shift- V作为这个功能的切换。
  • You can snap vertex to vertex, vertex to surface and pivot to vertex.
    你可以捕捉顶点到顶点,顶点到表面和轴心到顶点。

A video on how to use vertex snapping can be found here.

关于如何使用顶点捕捉的视频可以在这里找到。

分类:Manual|评论: 0|浏览: 311 翻译: 第七把剑
评论
暂无评论
发表评论
用户名:

评论审核后才会显示!