Implementing movement
Almost every object in the game moves one way or another: the player character with the keyboard; the enemies through AI; the bullets that simply move forward; and so on. There are several ways of moving objects in Unity, so we will start with the simplest one, that is, through the Transform
component.
In this section, we will examine the following movement concepts:
- Moving objects through
Transform
- Using input
- Understanding Delta Time
First, we will explore how to access the Transform
component in our script to drive the player movement, to later apply movement based on the player’s keyboard input. Finally, we are going to explore the concept of Delta Time to make sure the movement speeds are consistent on every computer. We are going to start learning about the Transform
API to make a simple movement script.
Moving objects through Transform
Transform
is the component that holds the translation, rotation, and...