Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Controlling animations with scripts: Third-person camera controller

From: Game Character Creation in Maya

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

In the last video we've looked at how to use a script to access the different animations of our game character and make it interactive. In this video let's take a look at another script that we can apply to make the camera follow our character around as he's moving. Luckily, we have another pre-built script for that. So in that Character Controller asset that we imported in the previous video I just want to look for this Third Person Camera script. I'm going to apply this just in the same way that we did with the controller script to the game character itself.

Controlling animations with scripts: Third-person camera controller

In the last video we've looked at how to use a script to access the different animations of our game character and make it interactive. In this video let's take a look at another script that we can apply to make the camera follow our character around as he's moving. Luckily, we have another pre-built script for that. So in that Character Controller asset that we imported in the previous video I just want to look for this Third Person Camera script. I'm going to apply this just in the same way that we did with the controller script to the game character itself.

So I'm just going to left-mouse click- and-drag and just drop this right over our game character. So now if I click in the hierarchy on our game character it should be able to scroll down here in the Inspector and now see this Third Person Camera component that's attached to our character. So the camera script is going to be looking for which camera we wanted to control. So right now there's just one camera in our scene. So that's the main camera. So in hierarchy I'll just click on that, just left-mouse click-and-drag, just drop that right on the Camera Transform component.

Below that we have some settings in the script for the Distance away from the character we want the camera to be as well as the Height and some speed settings for how a camera moves and response to the character's movements. So let's just leave this on a default. I'll go ahead and hit Play and we'll see how this works. So we can see when I hit Play the camera actually moved automatically. If I just go ahead and click the W key and make the character walk, I can do W+Shift to make him run. We can see that the camera is following him around. Now we can make a couple of adjustments here.

One really cool thing about Unity is that even when the game is rendering we can make changes through the Inspector and those will update on the fly. So let's just adjust the Distance and the Height here. So I'll bring the camera little bit closer, maybe just drop it down a little bit, and I'll increase this Angular Smooth Lag so that will allow the character to kind of the scene more from the front and the side as he turns and not always from the back. So just click back in my Game view here. So, now as I move him around I get a little bit more of a frontal view when he's walking and it's not always just locked on the back there.

Another thing you might notice is the lighting. Remember, in a previous video we set up the directional lights. The lights always coming from this side of the scene regardless of where the characters standing, some scenes that might be okay. In this one, I want to make the lighting a little bit more even. So I'll stop the rendering right now and let's take a look back to our Scene view. One little trick I can do is actually just parent that light to the camera. So in my hierarchy I'll just click on a directional light and parent it to the camera.

So now basically if I select both I can see so the directional light is facing this way, the camera's also facing this way. So it's kind of like the light is always going to be perpetually facing the direction that the camera is facing. So let's go ahead and play and we should see a little bit nicer lighting. That's pretty good. So it's just more even. Again, that may not be exactly what you want in your scene. So you might do it a little bit differently, but that should work well for us. Again, I'm just going to click back on the character here and we will make some adjustments to the Distance and Height.

So one thing to note is when you make changes through the Inspector as the game is rendering, they won't stay permanent. They will only be applied while the game is rendering. So once we stop the rendering these changes that I'm making now will disappear. Then maybe let's drop that Height down a little bit. That looks pretty good. So again I'm just holding down right now S+Shift to make him run, and A and D will turn him side to side and Spacebar will jump.

So those are just some simple techniques to control cameras with the script. In the next video we'll look at Unity's built-in animation interface and how we can make our own animations within Unity.

Show transcript

This video is part of

Image for Game Character Creation in Maya
Game Character Creation in Maya

40 video lessons · 8999 viewers

Chris Reilly
Author

 
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

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

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.


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.

Join now "Already a member? Log in

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
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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

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
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.