THE ROAD RUNNER TUTORIAL 3: ADDING A CHARACTER TO OUR GAME

Check out the gameplay of the finished game below:



Now that we have set up our game world, we will add a Character (The Road Runner, well, not the Road Runner we are familiar with though.) to our game.

Step 1:
Go to Assets->Import Package->Character Controller and import the Character to your project. Once imported just like the Skyboxes that we imported in the previous post, the Character will be available in the Standard Assets folder in the Project panel.

Step 2:
Once imported, we will use this Character in our game world. To do this just click on the Character Controller sub folder of Standard Assets,


Now you can see the 3rd Person Controller in the panel to the right of the Project panel. Drag that and drop it into the Hierarchy panel. Position this character to (0, 1.2, -7).

If you have followed the steps correctly, you will see that the Game screen like the image below:


Step 3:
It is time to configure this Character that we introduced to our game world. Click on the 3rd Person Controller in the Hierarchy panel and remove the two scripts at the bottom of this panel. Make sure you are left with Transform, Animation and Character Controller components on this character of ours.


If you are wondering what a Character Controller component is, don't worry. The next few sentences should make it clear, I hope. Character Controller is basically a part, or perhaps component is the right word, of the Unity Physics. It is commonly used on up-right character models like the one we are dealing with. With Character Controller you don't need to add a Rigidbody for collision detection.

P.S. Collider components describe the collision shape of an object. Collision Detection is the process of detecting the collision between two components which have Rigidbody/Character Controller. Rigidbody is needed to so as to be controlled by the physics engine of the Unity

Step 4:
Change the size of the Animations to 2. select run in Element 0 and jump_pose in Element 1 by clicking on the small circle with a dot inside.



Make sure the Play Automatically is Checked and run is selected in the Animation field as in the image above.

If we test this game by clicking on the play button, we can see that our runner is running, well at least he is acting like he is running, even though he is not moving forward.

Download the completed version of this game from the Resources page.

The Road Runner Tutorial 1: Setting Up The World
The Road Runner Tutorial 2: Setting Up The World Continued
The Road Runner Tutorial 4: Set The Ground Moving
The Road Runner Tutorial 5: Adding Snags and Powerups to Our Game
The Road Runner Tutorial 6: Collecting The Snags and Powerups
The Road Runner Tutorial 7: Adding Gameplay Logic
The Road Runner Tutorial 8: Creating a Custom GUI Skin
The Road Runner Tutorial 9: Creating a Pause Menu
The Road Runner Tutorial 10: Adding Countdown and Main Menu
The Road Runner Tutorial 11: Adding Sound Effects To Our Game
The Road Runner Tutorial 12: Porting The Game To Android
Share on Google+

About Sujit Horakeri

Sujit Horakeri is a game freak just like any other next door guy you would come across. He is a Web Developer by Profession, Game Developer by Choice.
Connect with him on:
    Blogger
    Facebook

13 comments:

  1. If I remove the scripts, cant move the character to the side. how did you do?
    thanks in advance

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. animations did not work and im using unity 5

    ReplyDelete
    Replies
    1. Same here. Have you solved the problem?

      Delete
    2. I have found a possible solution... By adding Animator and applying the characteristics to the Avatar :)

      Delete
  4. is it working for someone in unity 5 ?

    ReplyDelete
  5. this tutorial for which version of unity specify that sir

    ReplyDelete
  6. it didn't work for me.. where is the run option in element 0 - using unity 5

    ReplyDelete
  7. Anyone know how to get this working with unity 5?

    ReplyDelete
    Replies
    1. Use Third Person Controller with Animator component instead of Animation component.

      Delete
  8. where is the character controller source file for download?

    ReplyDelete
  9. I Used Unity 5
    and it is my first time for using it.

    I have a problem on player controller script
    "missing component" solve it when I notice the ThirdPersonController Object doesn't have a Character componenet

    So I get ThirdPeronController

    on PlayerControllerScript
    Start function

    " controller = GetComponent();
    "
    but not what can I do?

    ReplyDelete
  10. Where can i get the character?

    ReplyDelete