Unity3D说明文档翻译-Positioning GameObjects

来源:互联网 发布:下载中国网络电视台直播 编辑:程序博客网 时间:2024/06/06 08:36

Positioning GameObjects

定位游戏对象

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

当创建你的游戏时,你将会放置许多不同的对象到你的游戏世界里.

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. Each of the three transform modes can be selected with a hotkey -W for Translate, E for Rotate, R for Scale and T for RectTransform. (The RectTransform is used for positioning UI elements rather than positioning standard GameObjects - see the UI section of the manual for further details.)

使用工具条上的变换工具来移动,旋转和缩放单个游戏对象.每一个都有相应的小图示出现在场景视图内选定的物体上.你可以使用鼠标操纵任何小图示上的轴线来改变游戏物体的变换组件,或者你可以直接在检视面板的变换组件相应的数值框内键入数值.三种变换模式可以分别使用热键w(移动)e(旋转)r(缩放)和t(矩形变换,用于定位UI元素而不是标准的游戏对象,参考UI部分获取更多详情).

At the center of the Translate gizmo, there are three small squares that can be used to drag the object within a single plane (i.e. two axes can be moved at once while the third is kept still). If you have a three button mouse, you can click the middle button and drag to adjust the axis that was most recently moved (the arrow for this axis will change to yellow). If you hold shift while clicking and dragging in the center of the Translate Gizmo, the centre of the gizmo changes to a flat square, indicating that you can move the object around on a plane relative to the way the Scene View camera is facing.

在移动小图示中心是三个小面,可用于在单个平面内拖拽对象(例如,两条轴线可以同时移动而第三条保持不动).如果你有三键鼠标,你可以点击中键并拖拽来调整最近移动的轴线(此轴线的箭头会变为黄色).如果你按住shift键然后点击和拖拽变换小图示中间,小图示的中间将变成一个直角平面,意味着你可以在场景视图朝向的面上移动对象.

With the rotation tool selected, you can change the object’s rotation by clicking and dragging the axes of the wireframe sphere gizmo that appears around it. As with the translation tool, the last axis you changed will be colored yellow and can be further adjusted by clicking the middle mouse button and dragging. Think of the red, green and blue circles as performing rotation around the red, green and blue axes that appear in the translate mode. (Red is the x-axis, green in the y-axis, and blue is the z-axis.) Finally, the outer-most circle can be used to rotate the object around the scene view z-axis. You can think of this as rotating in screen space.

当选定了旋转工具,你可以通过点击和拖拽出现在对象上的球形线框小图示的轴线来改变它的旋转值.和移动工具一样,你最后改变的那个轴线将变为黄色,并可以进一步通过点击鼠标中键和拖拽来调整它.红绿蓝圆圈表示旋转出现在移动模式上的红绿蓝轴线(红-x轴,绿-y轴,蓝-z轴).最后,最外层圆圈可以用来通过场景视图的z轴旋转旋转对象.你可以认为这是在屏幕空间上旋转.

The scaling tool lets you rescale the object evenly on all axes at once by clicking and dragging on the cube at the center of the gizmo. You can also scale the axes individually, but you should take care if you do this when there are child objects since the effect can look quite strange. Again, the last axis changed appears in yellow and can be adjusted by dragging with the middle mouse button.

缩放工具让你可以通过点击和拖拽小图示中间方块来等比例的缩放对象.你也可以缩放单个轴线,但当有子物体时你应该特别注意,因为效果看起来会很奇怪.再次,最后修改的轴线将变为黄色,可以通过拖拽鼠标中键来调整它.

Note that in 2D mode, the Z axis can’t be changed in the scene using the gizmos. However, it is useful for certain scripting techniques to use the Z axis for other purposes; you can still set the Z axis from the inspector in such cases.

注意在2D模式,z轴在场景中不可以通过小图示改变.然而,通过脚本技术把z轴用于其他目的是很有用的;在此情况下你依然可以通过检视面板设置z轴.

For more information on transforming GameObjects, please view the Transform Componentpage.

更多关于变换游戏对象的信息,请查看变换组件页面.

Gizmo Display Toggles

小图示表现切换

 

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

小图示表现切换被用于定义任何变换小图示的位置.

Gizmo Display Toggles

小图示表现切换

 

For Position:

关于位置:

· Center will position the Gizmo at the center of the object’s rendered bounds.

· 中心 将把小图示放置在对象渲染边界的中心位置.

· Pivot will position the Gizmo at the actual pivot point of a Mesh.

· 中心点 将把小图示放置在网格当前的中心点上.

For Rotation:

关于旋转:

· Local will keep the Gizmo’s rotation relative to the object’s.

· Global will clamp the Gizmo to world space orientation.

局部 将保持小图示的旋转相对应对象的.

全局 将固定小图示为世界空间定位.

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.

使用变换工具循环拖拽任何小图示轴线,你可以按住control键(苹果系统命令)通过微调设置的定义来微调.

 

You can change the unit distance that is used for the unit snapping using the menu 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和control(苹果系统命令)来微调对象和任何碰撞检测的交集.这使得精确定位对象非常的快.

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和control(苹果系统)键来旋转物体朝向任何碰撞体表面的一个点.这使得对象的方向简单的彼此相对.

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 could align road sections precisely in a racing game orposition power up items at the vertices of a mesh.

由此你可以非常快速的装配你的世界.例如,你可以在竞速游戏快速排列路段或者在网格顶点连通位置项.

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.

· 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.

· Shift-V acts as a toggle of this functionality.

· You can snap vertex to vertex, vertex to surface and pivot to vertex.

选中你想要操纵的网格并确保变换工具是激活的.

按住v键来激活顶点微调模式.

移动光标到网格上你想作为支点的顶点上.

按住左键直到光标到达所需顶点并拖拽网格紧挨着另一个网格的任何其他顶点.

当你认为满意时释放鼠标按键和v键.

Shift-v 表现为开关此功能.

你可以微调顶点到顶点,顶点到面和轴心点到顶点.

 

0 0