Controlling and Choosing Positions
In this chapter, we will introduce a few recipes and demonstrate a selection of approaches to character control, spawn points, and checkpoints. In the next chapter, we’ll look at waypoints for AI-controlled characters traversing Unity navigation meshes.
Many GameObjects in games move! Movement can be controlled by the player, by the (simulated) laws of physics in the environment, or by Non-Player Character (NPC) logic. For example, objects follow the path of a waypoint, or seek (move toward) or flee (away) from the current position of a character. Unity provides several controllers for first- and third-person characters, and vehicles such as cars and airplanes. GameObject movement can also be controlled through the state machines of the Unity Mecanim animation system.
However, there may be times when you wish to tweak the player character controllers from Unity or write your own. You might wish to write directional logic – simple...