Start learning with our library of video tutorials taught by experts. Get started

Game Character Creation in Maya
Illustration by John Hersey

Controlling animations with scripts: Third-person character controller


From:

Game Character Creation in Maya

with Chris Reilly

Video: Controlling animations with scripts: Third-person character controller

So in the last video we covered importing our game character into Unity. So now let's look at some ways so that we can add interaction to our game character, and basically the way we do that in Unity is through scripts. So I am going to go ahead and import some scripts into Unity. These are scripts that come preinstalled with Unity. So this is part of the standard assets package that you should have with your install of Unity. So I am just going to go up to Assets > Import Package and I want to import this Character Controller package. So I just want to leave all these selected.
Expand all | Collapse all
  1. 3m 50s
    1. Welcome
      39s
    2. What you need to know before watching this course
      1m 9s
    3. Understanding game asset creation
      1m 21s
    4. Using the exercise files
      41s
  2. 25m 35s
    1. Setting up scene folders (Maya and Unity)
      3m 58s
    2. Optimizing geometry
      3m 14s
    3. Using symmetry
      4m 8s
    4. Extruding geometry
      4m 19s
    5. Sculpting geometry
      4m 1s
    6. Importing reference sketches
      5m 55s
  3. 37m 14s
    1. Modeling the head and nose
      5m 34s
    2. Creating the mouth
      4m 28s
    3. Crafting the eyes
      5m 11s
    4. Building the body and a wing
      10m 11s
    5. Forming the limbs
      8m 5s
    6. Adding finishing touches
      3m 45s
  4. 36m 11s
    1. UV mapping overview
      2m 43s
    2. UV mapping the body parts
      9m 18s
    3. UV mapping the face
      7m 40s
    4. UV mapping wrap-up
      3m 44s
    5. Mirroring
      4m 57s
    6. Texturing
      2m 46s
    7. Normal mapping
      5m 3s
  5. 46m 21s
    1. Setting up the skeleton
      5m 19s
    2. Building the spine
      3m 39s
    3. Finishing the skeleton
      4m 32s
    4. Rigging the legs and feet
      8m 35s
    5. Rigging the torso
      3m 49s
    6. Rigging the arms and hands
      3m 35s
    7. Rigging the face and head
      5m 9s
    8. Rigging wrap-up
      2m 27s
    9. Skin binding and weight painting
      5m 26s
    10. Animating in Maya
      3m 50s
  6. 29m 9s
    1. Exploring the Unity interface
      3m 3s
    2. Importing character and animations into Unity
      5m 50s
    3. Controlling animations with scripts: Third-person character controller
      7m 14s
    4. Controlling animations with scripts: Third-person camera controller
      4m 4s
    5. Making read/write animations using UnityScript Editor
      4m 8s
    6. Controlling scripts with animation events
      4m 50s
  7. 19s
    1. Additional resources
      19s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Game Character Creation in Maya
2h 58m Intermediate Sep 15, 2011

Viewers: in countries Watching now:

Get a thorough overview of techniques for creating characters for video games or real-time rendered applications. Author Chris Reilly covers low-poly modeling, texturing and animation, using 3D model and texture assets created in Maya and Adobe Photoshop. The course also includes an overview of Unity 3, including importing characters and making interactive animations with the Script Editor.

Topics include:
  • Optimizing, extruding, and sculpting geometry
  • Modeling a character's head and body
  • UV-mapping the head and body
  • Mirroring and texturing
  • Setting up the skeleton
  • Rigging the head and body
  • Skin binding & weight painting
  • Controlling animation with scripts in Unity
Subjects:
3D + Animation Modeling Character Animation Game Design
Software:
Maya
Author:
Chris Reilly

Controlling animations with scripts: Third-person character controller

So in the last video we covered importing our game character into Unity. So now let's look at some ways so that we can add interaction to our game character, and basically the way we do that in Unity is through scripts. So I am going to go ahead and import some scripts into Unity. These are scripts that come preinstalled with Unity. So this is part of the standard assets package that you should have with your install of Unity. So I am just going to go up to Assets > Import Package and I want to import this Character Controller package. So I just want to leave all these selected.

Just go ahead and click Import. Okay and then when I look in my Project folder, we should see this Standard Assets folder and I can expand that down. And there is a couple prefabricated game characters in here that we can play with too, if you would like. But what I want to look forward down here is this Sources, Scripts folder. This has a couple of pre-made scripts that are going to work to allow us to make our character interactive, so it can move around and respond to user input.

So we'll be going to looking at this ThirdPersonController script in this video. And if I click on that I can get a preview of the actual text. Now there are many ways in Unity to make a script that acts as a Character controller. So you can even write your own, a lot of people do it. Unfortunately, we don't really have the time in this course to go over the fundamentals of scripting and all the things you need to know for scripting Unity. But just be aware that there are a lot of different ways to set up a script that does a similar thing, and if you are interested, I would recommend checking out some of the Unity scripting tutorials.

Okay, so we will just make a couple of adjustments to our character in the hierarchy. The script that we are going to be using is actually expecting a model that scaled much smaller. So I am just going to adjust the Scale in my character's Transform component. And I am going to change it from 1 to 0. 01, so we are just going to temporarily make it a lot smaller and that's going to actually just be easier than adjusting the script itself. So I have got my character highlighted in the hierarchy and let's just go back to the Scene view. I am just going to hit F to automatically zoom-in on that character.

Right now, my character is the only thing in the scene. I actually need to give him sort of a floor to walk on. Otherwise, once we attach a Character Controller script, this character will actually have gravity attached to it, so it will just keep falling into space. So let's go ahead and create a GameObject, and I will just make a Plane. I'll just bring that down a little bit, and maybe in the plane's Transform Scale component, I am just going to make that a little bit bigger.

So that will at least give the character something to walk around on. So to make this character interactive, I am going to look in that Standard Assets folder that we imported, and I want to grab this ThirdPersonController script, and all I need to do is just left mouse click and drag, just drop this right on my game character and I am going to get this warning about losing Prefab. I am going to go ahead and Continue. It's okay. Basically, this is breaking the connection between our character model that's in the Project folder and kind of making a local copy that's just going to be used for this scene.

So I will click back in the hierarchy on our game character and I should see here I have got a couple extra components that I can see in the Inspector. So I have this Character Controller and this Third Person Controller. Both of these are scripts that are now attached to this game character. So I am just going to make a couple of adjustments here. Let's start by looking at the Character Controller. I'm just going to set some scaling here, and again, this might be different if your characters are slightly different size.

So basically what I'm doing here is forming sort of a rough shape that will represent the collider of my character. So this is going to kind of flesh out the rough physical shape and sort of help out with physics calculations that Unity will do during game play. So now let's move on to this Third Person Controller script and let me just expand that. What we want to look at here are these Animation Clips. So we've got the Script asking us for an Idle Animation, a Walk Animation, a Run Animation, and a Jump Pose.

So what I can do is look back to my Project panel, find that game character file, and I can see here I have got the animations that I've set up through my FBX Importer, and what I can do is just click and drag those over. So I am going to set the Idle Animation for Idle Animation. Walk for the Walk Animation and so on for Run and Jump. And there are a few other settings here as far as the Maximum Speed that the character can walk with, how high it's going to jump.

I am just going to leave these on defaults for now. One additional thing I want to do is add a light in my scene, so if I switch back to the Game view, let me just move my camera so I can see. So I want to just place that a little closer. Let me click here. I will click and rotate. Let me adjust this.

And I will click and drag this. So if we switch to Game view, I can see my character is very dark and that's because there are no lights in the scene. So I am just going to go ahead and add a directional light, so I will click GameObject > Create Other > Directional Light and then that will add this Directional Light to my hierarchy and let's go ahead and rotate this. Let me zoom in a little here. So I'll just rotate it so it's kind of shining on our character and if I switch to the Game and I can see that lighting looks a lot better.

So let's go ahead and click Play and we should see that our character has some interaction. So by clicking the A, W, S, and D keys, I should be able to make him walk around. So let's go ahead and click Play and see what that looks like. Okay. So I am clicking W here to walk forward, S to walk backwards, and I can turn using A & D. And if I hold down Shift, I can make him run. And I can jump with the spacebar.

So those are kind of the basics of using a script to add interactivity to your game character. In the next video, we will cover getting the camera to move around and follow the character as he walks and runs around.

There are currently no FAQs about Game Character Creation in Maya.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Game Character Creation in Maya.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked