O'Reilly logo

Unity 3.x Game Development Essentials by Will Goldstone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required