O'Reilly logo

Unity Android Game Development by Example Beginner's Guide by Thomas Finnegan

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

Time for action – controlling the chassis

A normal tank rotates in place, and it can easily move forward and back. We will make our tank do this with the creation of a single script.

  1. The second script is called ChassisControls. It will make our tank move around. Create it in the Scripts folder as well.
  2. The first three lines of the script define the variables the tank will need to move around. We will also be able to change them in the Inspector window, in case our tank is too fast or too slow. The first line defines a variable that holds a connection to a CharacterController component. This component will easily move the tank around, but will allow it to be stopped by walls and other colliders. The next two lines of code define how fast we move ...

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