Entering the world
In previous projects, we've relied on a first-person controller included with the Unity standard assets package. In this section, instead of relying on that package, we'll write our own functionality to accomplish the same task. We'll write a script to control the player's movement through the environment and another to control where the player looks. However, before we write the scripts, we'll create the required player object:
- Create an empty GameObject.
- Name the new object as
Body
. - To include the player object in the physics system and prevent them from falling through the floor, add a Rigidbody and Capsule Collider component.
- Set the Height of the collider to
2
to better represent the height of the player. - On the Rigidbody component, Freeze Rotation on the X, Y, and Z axes. Freezing the rotation on all axes will prevent the player from falling over as they collide with the environment. We will shortly write scripts...