‫Hello and welcome.
‫We're going to look at this great thing called a blend space in this lecture and how it allows us to
‫smoothly move between different types of movement.
‫Let's dive in and see it in action.
‫So as we've said, these blend nodes are not a very good way of doing animation with at least locomotion
‫animation, which is what we call this moving around animation.
‫So what is well, fortunately in Unreal, we have got an asset specifically designed for this kind of
‫thing.
‫When we want to blend between things in a two dimensional space, it's called a 2D blend space.
‫So what we're going to do is go over to our content browser and create one of these, and then I will
‫take you over what it is, what it means, and what's the point.
‫You go to add new animation and blend space.
‫You can see there's also a variant that is one dimensional.
‫We're going to be going for the two dimensional.
‫One reason being, we got two dimensions which are going to be the forward backwards dimension and the
‫left right dimension.
‫So let's go for that.
‫We've got to pick a skeleton that it needs to be based off.
‫That's going to be the Wraith skeleton, and then the prefix is going to be B's underscore, and we're
‫going to call it locomotion because it's all about moving our player around.
‫So we open up our locomotion asset and you can see that right off the bat.
‫It is a new editor yet again.
‫It's actually creating a new type of animation.
‫It's making animation out of other animations, but it's still sort of an animation.
‫And you can see that's displayed in the top.
‫Right.
‫We've got details for this asset which are currently empty.
‫We've got asset details over on the left.
‫I'm not quite sure what the difference is there.
‫I think the details over on the right might be to do with the animation selected.
‫We've got Skeleton Tree if you need it, but the main area is this middle one.
‫We've got a viewport and underneath it we have got this two dimensional graph.
‫And what this is saying is that we could put a value along the bottom, which might be our left right
‫and a value along the left, which is going to be up and down perhaps.
‫And then this green dot, we can move around to any position on here.
‫And what we'd like to happen is if I put it over to the top right, then we move forward and to the
‫right at top velocity.
‫If I put it over to the left, we move forward and left or down to the bottom.
‫We go backwards and left at full velocity and anywhere in between.
‫So that's the idea here.
‫We want to basically be able to move between these blend spaces and we want to be able to choose an
‫animation and blend between it.
‫So what actually happens?
‫Let's see if we can bring in a walk animation.
‫I'm going to bring in a walk left animation, a walk right animation over to the right here.
‫And then we've got forward and backwards.
‫So let's put a backwards down here and a forward up here and then you can move this little green dot
‫and you can see that it starts moving forward.
‫If I go up, starts moving backwards, if I go down and going over to the left and to the right, it
‫is essentially working as we would expect it to.
‫The only thing that's looking a little bit weird is here in the middle where we're kind of stomping
‫on the spot because we don't have an idle animation.
‫So we do need to introduce that.
‫But before we do any of that, we've got these axes that are labelled as none.
‫That's not particularly useful.
‫What should their labels be?
‫How do we change them?
‫Let's have a look.
‫We need to go over into our asset details here.
‫And there are axes, settings, so we've got a horizontal axis that's going to be our left and right.
‫So I'm just going to call this right.
‫And it's minimum value I'm going to put as minus one.
‫So going at minus one speed and maximum as plus one speed, we're going to update these based on the
‫actual values of the animations later on in the game.
‫Now the vertical axis, I can go and edit to be forward.
‫And we're going to go between minus one and one here as well.
‫So -1 to 1.
‫You can also select the number of divisions that you want in the grid.
‫Here we've got four divisions, but you could increase that if you want to put animations at different
‫intervals and we'll be doing that later on as well.
‫So this is interesting.
‫We've got our forward and our left and right and I appear to have lost my little green nubbin there.
‫So I'm going to just close down the asset, hopefully bring it back up and see.
‫Yep, there you go.
‫The green nubbin is back.
‫So now I can go back forwards, I can go backwards left and right now we want this to actually be more
‫complete so that we can run backwards, so that we can run forwards.
‫We can walk forwards, we can run left, we can run right.
‫And we can have an idle animation in the middle.
‫Now, if we were to do that, we would find that we end up with a kind of cross formation.
‫And at these points in between, it wouldn't really know or behave very well.
‫So what we're actually going to do is tweak these axes so that we get something a little bit different.
‫Instead of having right and forward, we're going to end up with having the angle.
‫And having the speed as the other dimension so that if we want to go backwards, you need to turn around
‫180 degrees on your angle and go at full speed.
‫So what should these values be?
‫Well, this should be a little bit different.
‫We're going to go from -180 to positive 180 on the angle, full circle.
‫And speed wise, we're going to go from zero to, I don't know, let's say 100 for now.
‫And then how would we be laying out these different animations that we've just laid out?
‫In one way we can lay them out differently.
‫We've got a backwards animation that's going to go at full speed at -180.
‫It's also going to go at full speed at positive 180.
‫So that backwards animation needs to be in two places.
‫So let's find our walk.
‫Four backwards and put it in this other place as well.
‫Now our walking, right?
‫That's going to go actually, that's a walking left animation that should go over at -180.
‫Our walking right should go over at our positive 180 and our full walk should go there in the middle.
‫And as I said, we do need some sort of idle animation.
‫So let's go and look for the idle combat animation.
‫Has the gun raised?
‫I believe so.
‫We go and put idle combat and we're going to put idle combat all the way along the bottom here in each
‫one of these slots to make the blend a super clear that no matter what angle you're at, if you're idle,
‫you want to be stationary.
‫So let's try that.
‫I can now move my angle.
‫You can see I start moving at a different angle depending on where I bring that green nubbin and if
‫I come down.
‫You can see it reduces my speed until I am idle.
‫So that's what it's doing.
‫No matter where I start and I come up and it starts to move me over to the left or to the right or wherever
‫I am, it is kind of making sense.
‫So my challenge to you is to complete this blend space.
‫We're going to do that by adding jog combat animation so that we can go faster as well as slower.
‫And where should they go in our scheme?
‫Whereabouts should they be put on this blend space?
‫Pause the video and have a go at that challenge.
‫Kay.
‫Welcome back.
‫So, first of all, we're going to want to move down probably these blend spaces here, the walk left,
‫the walk forward and right, because we're going to want the jog animations to go at faster speed at
‫the top.
‫Then we're going to go ahead and look for a jog and we're going to look for it.
‫Should be some of them are jog combat, I believe.
‫Let's try and find them somewhere in here.
‫Here we go.
‫There's a whole section down below.
‫The combat comes at the end.
‫So it's not very easy to search for, unfortunately.
‫But if we go and look for it, we should have a jog, forward combat.
‫They go put that in the middle.
‫We're going to need a jog.
‫Backward combat.
‫Where is that jog?
‫Backward combat.
‫That's going to go over to the right and the left for rightful left.
‫And we're going to need a left.
‫So jog left, combat's going at -180 or -90, in actual fact.
‫And the jog right combat is going at plus 90.
‫And I just noticed I left a gap here where we had our walk backwards.
‫So let's find walk right mouse button backwards over here.
‫And now it should be able to blend between these guys fairly accurately.
‫So going backwards, jogging backwards, jogging to the left.
‫Walking to the left.
‫My only problem appears to be that my idol animation has got all of this kind of looking to the left
‫and looking to the right business going on.
‫And if I go anywhere in between with this interpolation, it kind of goes a bit frenetic.
‫So what I want to do here is actually find a different Idol animation.
‫I've used the wrong one.
‫So if we go, it's not Idol combat that I want, but rather I think there's an idol ability, right?
‫Mouse button, which is more static.
‫So we'll go and bring that in over the top which replaces we've bring it over the top of those Idol
‫points on our combat space.
‫And now you can see if I bring that green nubbin around.
‫You can see we don't have any of that frenetic moving around.
‫We just got a very nice blend space that smoothly blends between our war animations, our stopped animations
‫and our running animations in any direction.
‫And that hopefully gives you an idea of why blend spaces are just so awesome at doing things like locomotion.
‫And by the way, it can be helpful to enable the labels in this view so that you can see what the names
‫of the animations are at the various points on this blend space.
‫In the next lecture, we're going to look at bringing this blend space in to our animation blueprint
‫and how to hook it all up.
‫See there.