Chapter     4

Making It Move: Scripting the Cube

Now that you know how to construct a static 3D scene by placing GameObjects, it’s time to make the scene dynamic, and more interesting, by adding movement to GameObjects while the game is played. After all, a 3D graphics scene is nice, but an animated 3D graphics scene is even better!

But applying animation data isn’t the only way to move a GameObject. Making a GameObject physical will cause it to move in response to collisions and forces, including gravity. And a script can also move a GameObject by changing the position and/or rotation values in its Transform Component. In fact, any method for moving a GameObject, whether it’s animation, physics, or a script, ultimately changes the Transform ...

Get Learn Unity 4 for iOS Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.