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 or position 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 表現為開關此功能.
你可以微調頂點到頂點,頂點到面和軸心點到頂點.