To make our game character move through the level more smoothly, we will modify the motion algorithm. Instead of relying on gravity on the rigid body to keep the player anchored to the ground, we will cast a ray downward and glue the player to the polygon directly below. In this way, the curvature of the terrain will play less of a role in restricting the player. This can be achieved by performing the following steps:
MAINscene, and double click on the
PlayerControlsscript on the player. In the
UpdateMovement()method, directly after the
CharacterController.Move()method is called, declare a
hitInfoas shown in the following code. This class will be used to return the position ...