Important Notice:

As of September 15, 2016, we no longer publish new courses on this website. We encourage you to use your Digital-Tutors credentials to sign in on Pluralsight where you'll find all new creative courses, skill tests and paths, 1:1 mentoring and more.
Blocking in the walk cycle
See Details
Joshua Kinney

Pluralsight

Joshua Kinney
In this lesson, we're going to begin our walk cycle. All right, now, we've created our idle animation, and we want to create a walk animation. This is going to be a little more complex. But there are a couple of things that we want to remember whenever creating new animations. First and foremost, you want to make sure that the Record is turned off, so there should be nothing red on the screen. And then we want to create a new clip. So put it in the same place. Let's just go ahead and call this Walk. And hit Enter. Now, make sure that your walk is selected, and then you also have the same key frame amount. So we did the last one at 30, so we're going to do this one at 30. Now what we can do is we can go through the process of animating everything. So select your character. Let's go to frame one. You'll see that the Record is turned on. If you click on the timeline anywhere, that's automatically going to turn on. So now, what we want to do is we want to set our initial pose for the walk. So in this case, what I'm going to do is I'm going to take the the left leg, and I'm going to rotate it backward. So let's go ahead and rotate that back. Like so. And, let's see. Yeah, we'll make that forward. Or, excuse me, back. Probably not that far back, because the zombie doesn't really have quite that large of a stride. So we don't want to get too carried away with it. So we're getting our initial poses here. We're at frame zero. Now, whenever a person walks, the arms are opposite of the legs. So for example, the left leg is forward, so the right arm needs to be forward. And then the right leg is back, so the left arm needs to be back. Now in this case, it's a zombie. And so the arms just hang there. I don't really want to do an arm swing. So what I'm going to do is I'm actually going to bring the arms up. Kind of like so. As if he's trying to point to where he's going. And so I'm going to bend the elbow there, and then I'm going to grab the hand. I'm going to drag that down there. Kind of like so. And then we're just going to leave that arm right where it's at. The left arm. So that looks pretty good. That's the initial pose there. And then what we're going to do from here is we're going to go to, let's say, frame 60. We'll do two seconds for this, just to get started. And then what we're going to do is we're going to create the exact same keys here, because we want a looping animation. So I'm just going to come in and I'm going to say, Add Keys. So I can left click right here, and I can add a key. And we can do that for all of these right here. And what it's doing is it's just creating an exact copy from there to there. Now, the reason that we didn't use that in the last lesson is because we had keys in the middle. And so what it does is it recognizes the last key, and then creates a copy of that key. All right. So now that we have this, we can take a look here. It's exactly the same. So everything looks good. Now let's go to the middle. What I want to do here is I want to offset the legs. So now, the right leg is going to be forward, and then the left leg is going to be backward. So it's going to look something kind of like that. And then, you could go ahead and you could make some adjustments to the arm, if you wanted to. But I'm going to go ahead and leave the arm just the way it is for right now. So this is what we should see. We should get a little bit of a skiing motion going here. So if I hit Play, we get something that looks like this. Now. Remember that it's changing abruptly because our curves. So let's go to Curves. And if we go to the left leg here, I could select this. Hold Shift, select the last one, right click, and flatten. Let's go ahead and do this one here. Select this one, hold Shift, right click, flatten. Or you could adjust the tangents. Whatever you feel comfortable with. Hit Play, and then we get something that looks like that. All right. So we're getting this sliding action here. Something else that we'll want to do. Let's go back to our [? dope sheet, ?] is we want to change the overall position of the legs, as though it looks like the hips are swinging a little bit. Now it's a 2D character-- that's not going to be possible, but we still want to give it that kind of motion. So. We have the first frame, and the last frame. So let's go right here in the middle. And I'm going to take this leg here, and I'm going to left click right here in the middle. And I'm going to hold Shift, and I'm just going to drag that to the right. So it just moves straight forward. OK, just a little bit. And then, I'm going to grab the leg behind. I'm going to hold Shift, and move that backward like this. There we go. And now, if I hit Play, you can see how that moves forward, but it doesn't move back. Now, the reason for that is because we don't have that key on the last frame. So here, you can see that right here. So let's go to the last frame. Go to left leg position. Left click on that, Add Key. Let's do the same thing for left leg upper rotation position. Add Key. Now, we're going to take the first key, and we need to copy all of these values. And that's going to be hard to do. At first, it's going to take some time. So, we're going to right click, copy. And this is going to be for our x value. We'll right click and paste. And let's go back to the first key. Left click, copy. And then, come over here, and I believe this is going to be the same. So, paste that there. Yeah, because we only moved it in the x. Let's do the same thing for this guy. So, we're going to select this key. Left click, copy on the x direction. This one, and paste. All right. So now, if I hit Play on that animation, you can see that that moves forward and backward, kind of giving us that appearance that the hips are swinging there. So we're still looking like a machine here, and so we need to add a little bit more weight to the character. Most of this is going to be done with the curves, But, we could start to pick out these areas. So, whenever the character is right about here, at frame 15. The leg that's moving forward should be kind of bent, a little bit. So, what does that look like? Well, let's take the lower leg right here. And what I'm going to do is I'm going to bring that up. Kind of like so. All right. And so now, you can see that that knee bends a little bit, and that it's going to come forward to this point right here. Now, that needs to straighten out again. So let's go ahead and add a key. Let's take this key right here, and it's just the rotation in the z. So let's select that entire value. Right click, copy. Let's go to this key here. And then we're going to right click, and paste. So now, it looks something like this. Now, it's not going to look quite right the entire time. Now you can see that the knee is bending there, making it look a little more natural. It's still very much like it's on a treadmill or something like that, or it's a machine, but getting much closer. So we're going to do the same thing for the opposite leg. So whenever it's moving forward, which is between here, we need to have that bend. So we're going to go to this frame, which is 45. And let's be sure that we have the right leg selected. Or the correct leg selected. Let's come up here. Frame 45. And we're going to rotate that back some. And then, we're going to set this key right here. So notice here that it's starting to bend from this point to this point. So what we need to do is we need to add a key right here. So let's go to that frame. Let's add a key. But it's not going to be the exact same value. So let's take this key frame. Let's copy this value. Let's go to this one. And let's paste that value in. It's going to be very slight, but it's not exact. So now, if I hit Play on this. Whoops. Let's go ahead and set that value here as well. Let's add a key. We've already copied that value, so let's go ahead and just paste it in. So now if I hit Play, see that the leg kind of bends a little bit. And let me bend that just a little bit further back. Something like that. There we go. So now, if we take a look at our zombie here, those legs are moving. Kind of see what we're getting at here. So we've just blocked in the legs here. So what we're going to do in the next lesson is we're going to go ahead and block in the upper body for this walk animation. And then, we'll add some weight to that. And then after that lesson, what we're going to do is we're going to come in, and we're going to bring all of this together using the mechanim system and show you how we can blend animations. And then we'll start to tie that to our control keys. And then we'll get our character moving on screen, and we'll actually move him across the level. So we'll get started with that next.
In this series of training we will discuss the major components of working with the 2D features in Unity. We'll start off by learning how to set up a 2D Unity project. Then we'll learn how to properly import and slice our sprites. After that we'll learn how to manipulate sprites by blocking in a simple platform level and also learn the importance of Sorting Layers.

Then we'll jump into the real fun by assembling, parenting and animating a character. By the end of this tutorial, you will have a better understanding of working with Unity's 2D features.