Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity 3.x Game Development Essentials

You're reading from   Unity 3.x Game Development Essentials If you have an idea for a game but lack the skills to create it, this book is the perfect introduction. There’s lots of handholding through all the essentials, culminating in the building of a full 3D game.

Arrow left icon
Product type Paperback
Published in Dec 2011
Publisher Packt
ISBN-13 9781849691444
Length 488 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Will Goldstone Will Goldstone
Author Profile Icon Will Goldstone
Will Goldstone
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Unity 3.x Game Development Essentials
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Enter the Third Dimension 2. Prototyping and Scripting Basics FREE CHAPTER 3. Creating the Environment 4. Player Characters and Further Scripting 5. Interactions 6. Collection, Inventory, and HUD 7. Instantiation and Rigidbodies 8. Particle Systems 9. Designing Menus 10. Animation Basics 11. Performance Tweaks and Finishing Touches 12. Building and Sharing 13. Testing and Further Study Index

Understanding Translate


To actually use these variables to move an object, we will use the Translate command. When implementing any piece of scripting, you should make sure you know how to use it first.

Translate is a command which is part of the Transform class: http://unity3d.com/support/documentation/ScriptReference/Transform.html.

This is a class of information that stores the position, rotation, and scale properties of an object, and also functions that can be used to move and rotate the object.

The expected usage of Translate is as follows:

Transform.Translate(Vector3);

The use of Vector3 here means that Translate is expecting a piece of Vector3 data as it's the main argument—Vector3 data is simply information that contains a value for the X, Y, and Z coordinates; in this case coordinates to move the object by.

Implementing Translate

Now let's implement the Translate command by taking the h and v input values that we have established, placing them into Vector3 within the command.

C# and...

You have been reading a chapter from
Unity 3.x Game Development Essentials
Published in: Dec 2011
Publisher: Packt
ISBN-13: 9781849691444
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime