Beginning Unity 3D for iOS: Part 1/3

A beginning Unity 3D tutorial that shows you how to make a simple game for the iPhone. By Christine Abernathy.

Leave a rating/review
Save for later
Share
You are currently viewing page 2 of 6 of this article. Click here to view the first page.

Getting a Hand

The Hand Tool allows you to manipulate your view of the scene.

Hand Tool

The best way to understand the Hand Tool’s use is to imagine yourself dropped into the 3D scene with many GameObjects. Some objects in front of you are visible, while others that are behind you are not.

You may wish to step back in the scene (zoom out) to see more of the view, move to the left or right to see other objects, or swivel and pan around to see what’s behind you. The Hand Tool can do this for you.

As you start to add more GameObjects, you’ll find yourself using this tool more and more to establish your view in the scene before positioning GameObjects.

To see the Hand Tool in action, first select it (left-most choice on the toolbar), then select the Main Camera from the Hierarchy View (just so you have something to look at in the Scene View). You can then drag the canvas to move around the scene.

To zoom, you can use your mouse wheel or hold down Control and drag. You can rotate by holding down option and dragging. If you want to reset your view at any time, you can click on one of the axes on the Scene Gizmo in the upper right.

Hand Tool

Play around with the hand tool a bit and get comfortable with moving around and using the Control and Option combinations to zoom/rotate.

You’ll be switching between the hand tool and other tools a lot, so it helps to remember its shortcut keys. By default, the keys are bound to the keys on the upper left of your keyboard – Q, W, E, and R for Hand, Move, Rotate, and Scale, respectively.

Note: The Hand Tool does not move objects. It only alters your view of the scene, so it may appear as if the objects are moving. Practice moving around the scene using the various Hand Tool options.

Move It Or Lose It

With the Move Tool, you can move GameObjects in 3D space.

Move Tool

Select the Main Camera (double-click it in the Hierarchy View if you don’t see it in the Scene View) and click on the Move Tool. You should see a gizmo around the Main Camera with arrows representing the three axes. These point to where you can move the object:

Move Gizmo

The red arrow represents the x-axis, the green arrow the y-axis, and the blue the z-axis. You can translate or move a GameObject by first selecting the object, left-clicking, and then dragging inside the gizmo (the cube portion).

Select the Main Camera and move it around. Take a look at the Inspector’s transform component. The Position section has x, y, and z values representing the GameObject’s position. As you move the object around, notice that these values change.

Transform Component in Unity

You can change a GameObject’s transform position using either the Move Tool or by typing the position you want directly into these fields.

If you wish to move a GameObject in only one direction, select the relevant axis in the gizmo, left-click and drag that axis. Test this with the Main Camera object by moving in only the x direction and checking that only the x-position value changes in the Inspector. Repeat the same test with the y and z axes.

Inspector after X axis movement

At this point you know how to move your personal view of the scene around, as well as how to move objects around. So far so good!

You Spin Me Right Round

The Rotate Tool allows you to rotate GameObjects in 3D space.

Rotate Tool

To understand the Rotate Tool and how to use it, it’s useful to discuss the Scene Gizmo in more detail. The Scene Gizmo is found on the top-right of the Scene View and has different modes for different views.

One mode (shown in the below right image) is the free-form view that enables you to view your scene in a 3D perspective. This is useful if you want to get a better representation of what your game looks like in 3D space.

You can click on the text under the gizmo to switch to an isometric view (shown in the below left image). This mode is useful in visualizing a GameObject when it’s being rotated.

Scene Gizmo - Perspective View

Another mode is the x-axis view, which enables you to view your scene as if you’re looking down the x-axis. This is useful if you want to move a GameObject along either the y- or z-axis while keeping the x-axis unchanged:

Scene Gizmo - X View

In a similar fashion, you have the y- and z-axis view modes to enable the view of the scene from those respective axes:

Scene Gizmo - Y View

Scene Gizmo - Z View

Select the Main Camera. Switch to the free-form perspective mode by right-clicking on the gizmo and selecting Free.

Switch to Free Form View

Then click on the text below the gizmo to switch between the isometric and perspective modes. Click on the x-, y-, and z-axis modes in turn to see how the Scene Gizmo and Scene View change.

Select the free-form view once more to test out rotation. With the Main Camera still selected, click the Rotate Tool. You should see a gizmo around the Main Camera containing circles with colors representing the three rotation axes:

Rotate Gizmo

Left-click in the center of the Main Camera and use your mouse to drag-rotate it around. Note that the Inspector’s Transform\Rotation properties change as you rotate the object. Note that you can manually edit these values in the Inspector if you’d like.

By clicking in the center of the Main Camera during rotation, you are doing a free-form rotation around all axes. You can also rotate the GameObject around one axis by clicking on one of the colored circles representing that axis. For example, to rotate only around the x-axis, click the red circle to select it, then hold and drag to rotate the object. Repeat the same process to rotate around just the y or z axis.

It All Comes Down to Point of View

Another key concept worth learning at this point is the difference between the local and global (or world) view.

Toolbar - Global

Toolbar - Local

Reset the Main Camera’s rotation to 0,0,0 through the Inspector\Transform\Rotation fields. Click the button so the toolbar says “Local”. Then select the Move Tool so you can see the Scene Gizmo:

Global and Local Aligned

Notice that the Scene Gizmo and the Main Camera’s Gizmo line up, in the sense that the x-axes point in the same direction, as do the y- and z-axes. Now rotate the Main Camera around on the z-axis using the Inspector by setting the Transform\Rotation value to 0,0,-20.

Global and Local Alignment after Rotation.

Notice that the Main Camera’s Gizmo is now rotated around the z-axis – this represents the axis of the object in its local coordinates. This is different compared to the Scene Gizmo, which shows the global space orientation. Switch to Global view to see the difference.

Later in the tutorial, you’ll learn about moving GameObjects and find that it matters which space (world or local) you specify for the movement to use.

Taking a look at the rotated Main Camera, if you were to now move it in the x-direction based on its local space view, it would end up in a different place than if you were to move it in the x-direction based on the global space orientation. Keep that nugget tucked in your mind for later use!

Before you move on, reset the rotation to 0,0,0 to get back to a clean slate.

Christine Abernathy

Contributors

Christine Abernathy

Author

Over 300 content creators. Join our team.