Game Development Reference
In-Depth Information
Figure 4-5. Left: MouseOrbit script component of Main Camera. Right: MouseOrbit script code
The MouseOrbit script needs to know which game object to orbit the camera around. Its default is
“None,” so even though this script is attached to the camera, nothing different would happen if you
played it now. You can see the target property as shown in Figure 4-6 .
Figure 4-6. Target property of the MouseOrbit component of the Main Camera
Select one of the cube prefabs listed in the Hierarchy view and drop it into the MouseOrbit Target
property in the Inspector. The cube's name should replace the word None.
Play ( +P), and see how the camera moves in conjunction with your mouse movement while staying
focused on the cube you selected. Look around and check out the flare effect you have on your
light—it's even remarkable with movement.
With the Main Camera still selected in the Hierarchy, now try adjusting some of these MouseOrbit
script properties in the Inspector to see how they affect mouse movement. If you do this during Play
mode, your changes will be lost. Alternatively, if you don't like the changes you made while out of
Play mode, you can use the gear icon to reset these properties to their default values.
Playing around with these properties isn't just gratuitous fun for the purpose of this exercise; it is
practice in developing your intuitive “feel” for gameplay. You know what games you like, you know
how they feel, and you can tell if they just seem off. Play mode is how you test the user experience.
If you think it's acting subpar or just strangely, you can bet your users will, too. Okay, playing around
with the properties can be a little gratuitous, but that's the point. It's a game—it's supposed to be fun!
Select the MouseOrbit icon in the Assets folder of the Property panel to display the script in the
Inspector (Figure 4-7 ).
Search WWH ::




Custom Search