Creating our player

To begin with, let's add in our player so we can see what the world itself looks like. Thankfully, Unity has created some of these behaviors for us that are included in the engine.

  1. Open up our Exterior level if it isn't open already and to make it easier to see, go to the Lighting tab and in the Scene section uncheck the Fog property.
    Creating our player
  2. Next, go to Assets | Import Package | Characters. This will open up a window with a lot of different assets included. In this case, we will not need the PhysicsMaterials and Characters folder aside from the FirstPersonCharacter so uncheck them. Closing all the folders should show something similar to this:
    Creating our player
  3. Once finished selecting the correct actions, click on the Import button and wait for everything to be imported.
  4. Once imported, move to the Project tab and open up the Standard Assets/Characters/FirstPersonCharacter/Prefabs folder. From there, drag and drop the FPSController object into our scene.
  5. Double-click on the object to zoom into it on the Scene tab and from there drag it up in the Y axis until it's onto of the surface.
    Creating our player
  6. The prefab object already contains a camera so we don't need the default one anymore. With this in mind, go to the Hierarchy tab and delete the Main Camera object.
  7. Finally, go back to the Lighting tab and then recheck the Fog option.
  8. Save your level and then play the game!
    Creating our player

As you can see, we now have a character that exists and will walk around when we press the WASD keys. It also traps (or captures) mouse input until we press the Esc key, and if we hold down Shift, we will move quickly running. This is a great starting point from which we can build our own character.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.22.161