Time for action – putting the pieces together
That was the last of the scripts, for the moment. We have our tank and our scripts; the next step is to put them together.
Now, we need to add them to our tank. Remember how we added our
Tic-tac-toe
script to the camera in the last chapter? Start by selecting your tank in the Hierarchy window. Before they work, we will first need to add theCharacterController
component to our tank. So, go to the top of the Unity Editor and select Component, then select Physics, and finally click on the Character Controller option.You will notice that a green capsule also appears on the tank in the Scene view; at the same time the new component is added. This capsule represents the space that will collide and interact with other colliders. The values on the CharacterController component let us control how it interacts with other colliders. For most cases, the defaults for the first four are just fine.
Slope Limit: This attribute shows us how steep an incline the...