Time for action – moving treads

  1. There is just one thing left to do, and then we will be done with materials and can go on to make the game even more fun. Remember the Offset value of the materials? It turns out that we can actually control that with a script. Start by opening up the ChassisControls script.
  2. First, we need to add a few variables to the beginning of the script. The first two will hold references to our tank tread renderers, the part of the mesh object that keeps track of the material that is applied to the mesh and actually does the drawing. This is just like how the characterControl variable holds a reference to our CharacterController component.
    public Renderer rightTread;
    public Renderer leftTread;
  3. The second two variables will keep ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.