Game Development Reference
In-Depth Information
Chapter 5
Moving the GameObject
You have built a basic scene and populated it with GameObjects. You've added scripts to allow user
interaction to add and destroy GameObjects, as well as change their appearance. Now it's time to
add movement.
First you'll learn how to use the GameObject's Transform component to move the GameObject
through a script. Then you'll get an introduction on how to use Unity's Mecanim system with more
complex GameObject characters from the Asset Store. These come with built-in animations that you
will learn to manipulate via your scripts.
The Unity game engine also provides for GameObject movement and interaction in response to
forces like gravity or collisions with other GameObjects. These are controlled by Unity game engine
physics and will be covered in Chapters 6 and 7.
Rotate
Since a sphere looks the same from any angle, it isn't the best shape to use for demonstrating
rotational movement. Rather than delete it, let's just disable it for now. In the Prefabs subfolder found
in the Assets folder of the Project panel, select the Sphere prefab. Near the top of the Inspector,
uncheck the box to the left of the prefab name Sphere to disable it (Figure 5-1 ).
Figure 5-1. Disable the Sphere prefab in the Inspector
109
 
Search WWH ::




Custom Search