Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more 3D + Animation and personalized recommendations.Start Your Free Trial Now
- View Offline
- 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
Skill Level Intermediate
So now that we are little bit more familiar with the Unity interface, let's go ahead and open up the project we created in the first chapter. So I will click on File > Open Project, and I don't want to save these changes that I made to the default scene. Okay, so we have got our project open. Let's take a look at our assets. So this is my Maya project. I am just going to expand this here and I want to scroll down to scenes, Chapter 5, and this is the version of our character that we are going to import into Unity.
So I'll just click on this to bring it up in the Inspector and before we bring the character into our scene, I want to set up a few options in this FBXImporter component. So this is going to tell Unity exactly how to import our character along with its animations into our game project. And really this Animation section is the one I want to pay the most attention to. So I want to make sure that this Bake Animations option is selected. This is going to allow Unity to use that FBX plug-in through Maya to bake all the IK animations and take care of all exporting automatically.
That's going to leave our Maya project very fluid and we can go back and make changes easily and then Unity will automatically bring those in and our character will just be ready to go. The Animation Wrap Mode, so we can set a default way for animations to either loop or stop at the end or go forwards and backwards. I am just going leave this on default but let's just look at the options here. So we can have by default every animation play only Once and stop. We can have it Loop over and over again. PingPong means it plays forward, then reverse and so on.
ClampForever plays once and will look to a script as though it's playing forever. That one is a little bit more complex. Again, we are just kind of touching on the basics of getting a character into Unity. Obviously, Unity is a very complex program. There is a lot more depth that we can go in to that. Unfortunately it's just beyond the scope of this course. So here under the Split Animations options, we have the table with animations. So like we talked about in the previous chapter, I built all of my animations into my Unity character's timeline in the Maya project, and I am going to tell Unity to split those animations up into separate components.
So let's go ahead and get those set up. I am going to click this little plus icon here. So we will add an animation. By default, it's going to be called idle. And I will use that to set up the idle animation, which in my Maya project starts on Frame 66 and Ends on Frame 167. And for this one I want to set the Wrap mode to Loop, because I just want this to loop over and over again. So that way, if the character is just standing still, that idle animation will always be playing. So he will always have a little bit of movement and never just be standing completely still.
Now this other Loop Option here. This can help out if your animations aren't perfectly set up for cycles. So if there is a little bit of jump between the Last frame and the Start frame, Unity will try to smooth out that transition but I am just going to leave that unchecked for now. So just go ahead and set up, all the rest of animations that I have built into my Maya file. So the walk animation starts at Frame 2 Ends at Frame 34. And again, the Wrap Mode on this one, I want it to loop because if the character is walking, I just want it to loop over and over again.
Then I will do run animation which starts at Frame 35 and Ends at Frame 51 and I also want this to loop. And finally the jump animation starts at Frame 53, ends at Frame 55, and this one I just want to play it once. Okay, and that's pretty much it for settings.
The Animation Compression you can leave on the default and just click Apply and Unity will go ahead and use that FBX plug-in to automatically import your Maya file into the FBX format that we need to use in Unity. So as far as animations go, this is a pretty basic set for a character. So idle, walk, run, and jump. Those are kind of just the basics to get a character to move around and be interactive. Now obviously, your character might be different, your gameplay might be different. So you might have fewer or many more animations to import along with your character, but again we just want to touch on the basics of getting a character with animations into Unity to make it interactive.
Okay, so we've gone ahead and set up our changes through the FBXImporter. Let's just see what that looks like. So I am going to go down to my Project panel, just click and drag my character into the Scene Editor. And by doing that I can see I have also had automatically had that character added to the scene hierarchy. So let me just select that in a hierarchy and look over here in Inspector, and I can see this character already has an animation component attached to it and if I expand the list of Animations, so I can see Unity has automatically separated out those animations into discrete elements.
In the default animation that's going to play when I run the game is just the idle animation. So let me make some adjustments to the camera here, so I can make sure that my character will be visible. So I just kind of move and rotate this around. Okay, and let's just switch to Game view and see how that looks. When I hit Play here to preview the game rendering, I should see the character's idle animation. That looks pretty good. We will go through some steps in the next video to actually make our character interactive.