WEBVTT

00:07.630 --> 00:08.200
All right.

00:08.200 --> 00:14.440
So we need some animation blueprints for our characters and for this top down project.

00:14.440 --> 00:16.420
These are going to be relatively simple.

00:16.540 --> 00:22.390
Let's get started with Ora's animation blueprint before we move on to the enemy.

00:22.420 --> 00:27.100
Now here in the Ora folder, I'm going to make my animation blueprint.

00:27.130 --> 00:28.090
Right click.

00:28.090 --> 00:30.610
Animation, animation, blueprint.

00:30.610 --> 00:33.520
And for this I'm going to choose src ora.

00:33.550 --> 00:35.820
That's Ora's skeleton asset.

00:35.830 --> 00:40.030
So we can create and I'll call this app ora.

00:40.730 --> 00:42.080
Opening that up.

00:42.080 --> 00:44.810
This will be fairly simple.

00:44.810 --> 00:46.790
I'll have a single state machine.

00:47.120 --> 00:51.680
So I'm going to right click type state machine, grab one of those.

00:51.710 --> 00:57.740
I'll call this main states and before I hook it up to the output pose, I'm going to run it through

00:57.740 --> 00:58.430
a slot.

00:58.460 --> 01:01.730
So I'm going to choose default slot and hook that up.

01:02.000 --> 01:08.840
As you should know, a slot is used for playing montages and we will be playing montages.

01:08.870 --> 01:19.190
Now for main states, we want an idle walk run state, so I'm going to drag off of entry, add a state,

01:19.190 --> 01:22.460
I'm going to call it idle walk, run.

01:22.460 --> 01:26.040
And inside of this state I want a blend space.

01:26.060 --> 01:35.060
Now if I click on asset browser, we'll see that our assets contain this idle walk run and it's a basic

01:35.060 --> 01:35.970
blend space.

01:35.990 --> 01:42.660
If I hold control and drag my mouse, I can see her walking and I can drag it all the way up and we

01:42.660 --> 01:46.640
can see that she's running and there are even footstep sounds.

01:46.650 --> 01:47.850
So this is great.

01:47.850 --> 01:50.670
We're going to use this in AVP Aura.

01:50.680 --> 01:55.770
I'm going to go ahead and just drag it on in and hook it up so we have an idle walk run, but we do

01:55.770 --> 01:56.730
need the speed.

01:56.730 --> 02:02.100
So we're going to go into the event graph and set up a couple of variables.

02:02.100 --> 02:09.240
For one, I'm going to override Blueprint, initialize animation, and we're going to take that.

02:09.240 --> 02:13.230
I'm going to drag it up to the top and we're going to try get pawn owner.

02:13.230 --> 02:20.790
I'll bring that node up here and we'll go ahead and cast this to BP or a character.

02:20.880 --> 02:22.200
We'll get that.

02:22.200 --> 02:27.210
And I'm going to promote this to a variable drag off, promote a variable.

02:27.330 --> 02:30.060
I'll call this BP or a character.

02:33.350 --> 02:37.490
And from the Aura character, I'm going to get the movement component.

02:37.490 --> 02:43.820
So character movement is what it's called, and we'll promote this to a variable as well.

02:44.870 --> 02:47.150
I'll just leave it character movement.

02:47.150 --> 02:51.410
I'll go ahead and take the space out of the name and hook that up.

02:51.410 --> 02:58.970
So now we have the character movement component that we can access in Blueprint update animation.

02:58.970 --> 03:06.560
Now, if we wanted a much more complicated animation blueprint, we could use Blueprint Threadsafe update

03:06.560 --> 03:07.640
animation.

03:07.640 --> 03:11.780
But this is a simple one, so we don't need to use Multithreading.

03:11.780 --> 03:19.430
But we would use that instead of blueprint update animation for a much more complicated animation blueprint.

03:19.430 --> 03:26.780
But here all I'm going to do is get the BP or a character I'm going to control left click, drag that

03:26.780 --> 03:31.280
out right, click on it and convert to a validated get.

03:31.430 --> 03:38.160
And if it's valid, then I'm assuming the character movement variable will be valid as well.

03:38.160 --> 03:41.400
And from the character movement, I'm going to drag that out.

03:41.430 --> 03:44.970
I'm going to get the velocity from it.

03:47.580 --> 03:52.320
And from the velocity I would like the length x, y.

03:52.350 --> 03:59.100
That's just the lateral speed for the character movement and I'm going to promote that to a variable.

03:59.190 --> 04:00.900
I'm going to call it ground speed.

04:01.950 --> 04:08.220
So we now have a ground speed variable and I'm going to drive my blend space with ground speed.

04:09.480 --> 04:11.640
So we can compile and save that.

04:11.640 --> 04:14.220
And we see aura in the nice idle pose.

04:14.250 --> 04:15.180
That's great.

04:15.180 --> 04:23.250
So I'm going to go back to BP Aura Character, select the mesh and we'll set the anim class to App Aura.

04:23.850 --> 04:25.450
And she's idling.

04:25.470 --> 04:26.330
Great.

04:26.340 --> 04:28.440
So now we need one for the enemy.

04:28.440 --> 04:31.790
But the thing is, we're going to have multiple enemies.

04:31.800 --> 04:36.360
They're not all going to share the same skeletal mesh and skeleton.

04:36.360 --> 04:43.890
So to make this more versatile and to prevent repeat code, our Enemies animation blueprint is going

04:43.890 --> 04:46.770
to be a template animation blueprint.

04:46.770 --> 04:49.200
So we're going to go back out to character.

04:49.200 --> 04:55.740
And here in the character folder, I'm going to make a common animation blueprint template that we can

04:55.740 --> 05:01.260
use for all of our enemy animation blueprints, and that'll save us some work.

05:01.350 --> 05:09.360
So I can right click, go to animation, animation blueprint, and I can choose specific skeleton or

05:09.460 --> 05:10.030
template.

05:10.030 --> 05:13.600
I'm going to choose template and select Create.

05:13.720 --> 05:19.180
And we now have our animation blueprint template that we can use for our enemy.

05:19.180 --> 05:27.130
So I'm going to just call this app Enemy and we'll go ahead and open this up and we can put things here

05:27.130 --> 05:31.480
that we want all of our enemy animation blueprints to have in common.

05:31.480 --> 05:34.390
For one, we're going to need a state machine.

05:34.390 --> 05:36.880
So I'll go ahead and add one.

05:38.260 --> 05:41.440
Just like with aura we'll call this main states.

05:42.430 --> 05:46.990
And just like with Aura, we'll run it through a slot.

05:47.020 --> 05:53.820
We'll use default slot and our main states is going to want an idle walk run.

05:53.830 --> 05:58.990
So we'll drag out, add a state, we'll call this idle walk, run.

05:59.590 --> 06:05.410
And here in idle walk, run, we're not going to drag in any particular blend space.

06:05.410 --> 06:12.910
We're going to right click and type blend space player and we're going to use blend space player.

06:12.910 --> 06:15.430
And this is a generic node.

06:15.430 --> 06:18.670
We're going to hook that up to the output animation pose.

06:18.670 --> 06:24.790
So when we create a child animation blueprint derived from this template, all we have to do is select

06:24.790 --> 06:27.040
the blend space player and we'll do that.

06:27.070 --> 06:31.420
But we also need a variable to drive the blend space x axis.

06:31.420 --> 06:32.890
That's going to be the speed.

06:32.920 --> 06:36.850
So we'll go to the event graph and we'll do what we did for Aura.

06:36.850 --> 06:43.190
We'll basically try get Pawn Owner that's going to be on Blueprint, initialize animation.

06:44.960 --> 06:51.260
And for try get pawn owner we're going to just simply cast to aura enemy.

06:52.400 --> 06:56.020
That's the C plus plus class from Aura Enemy.

06:56.030 --> 06:58.940
We're going to get character movement.

07:00.850 --> 07:04.210
And we're going to promote that to a variable.

07:07.170 --> 07:08.910
And we'll hook this up here.

07:09.090 --> 07:15.080
Now, if we decide later that we need a variable for the enemy, we'll promote it then.

07:15.090 --> 07:19.350
But for now, we're just going to use the character movement and get that ground speed.

07:19.350 --> 07:23.460
So I'm going to control, click and drag out, get the character movement.

07:23.460 --> 07:25.620
I'm going to make this a validated get.

07:25.620 --> 07:29.340
And if that's valid, we'll get the velocity.

07:33.250 --> 07:35.350
We'll get length x y.

07:36.940 --> 07:41.080
And we'll promote this to a variable called groundspeed.

07:45.330 --> 07:46.440
We'll set that.

07:47.830 --> 07:56.350
And we can use ground speed to drive the x axis on our blend space player and compile and save that.

07:56.350 --> 08:04.350
And now we need to make a child based on this animation blueprint template for our goblin sphere.

08:04.360 --> 08:11.590
So I'm going to go into Goblin Sphere, right click, go to animation, animation Blueprint, and this

08:11.590 --> 08:17.350
time choose the parent class enemy and I can choose a specific skeleton.

08:17.350 --> 08:24.310
We'll choose SRC Goblin and click Create and I'll call this app Goblin.

08:25.490 --> 08:27.230
Underscore spear.

08:28.050 --> 08:34.050
Well, open that and all we need to do here is go to the asset override panel.

08:34.050 --> 08:39.960
If you don't see it, go to window and make sure asset override is checked there and we'll expand the

08:39.960 --> 08:43.980
dropdown for anim graph main states Idle walk, Run.

08:43.980 --> 08:49.470
Here's the blend space player and we'll see that we can set this to one of our blend spaces and we have

08:49.470 --> 08:52.680
some blend spaces in the assets for this project.

08:52.710 --> 08:56.820
We have one for the Slingshot Goblin and one for the Spear Goblin.

08:56.820 --> 09:03.300
So we're going to select Goblin, Spear, Idle Run and we'll use that compile.

09:03.300 --> 09:07.470
And we see that our goblins now idling here in the preview window.

09:07.470 --> 09:10.410
And if we go to Goblin Spear.

09:11.900 --> 09:14.030
And we select the mesh.

09:14.030 --> 09:19.070
We can choose a goblin spear and our goblin is idling.

09:19.100 --> 09:19.940
Perfect.

09:19.970 --> 09:23.300
Now, what's that goblin slingshot we just saw?

09:23.330 --> 09:27.770
If we look at it in the asset browser, here's that goblin slingshot.

09:27.800 --> 09:29.270
I can double click on it.

09:29.270 --> 09:31.130
And this is what it looks like.

09:31.310 --> 09:38.010
So you'll see that it's animated a little bit differently to accommodate for a slingshot.

09:38.030 --> 09:41.910
That means we must have a slingshot weapon asset as well.

09:41.930 --> 09:48.650
If I go to Assets and Enemies Goblin, you'll see there's a slingshot folder.

09:48.650 --> 09:53.900
And right here in the centered folder, we have an xxm slingshot.

09:53.930 --> 09:55.610
Here's what it looks like.

09:55.610 --> 10:02.900
And the pouch even has a bone that we can move and you'll see that the slingshot actually stretches.

10:04.000 --> 10:05.170
Pretty awesome.

10:05.170 --> 10:09.820
So that means we're going to have a different type of goblin enemy.

10:09.820 --> 10:13.290
That's why we call this one goblin spear.

10:13.300 --> 10:16.900
We're going to want a goblin slingshot as well, aren't we?

10:16.990 --> 10:18.760
So why don't we do that?

10:19.430 --> 10:22.550
And that's actually going to be your quest.

10:23.510 --> 10:30.470
So for this quest, you're going to make the Slingshot goblin, call it Goblin Slingshot based on or

10:30.500 --> 10:35.870
enemy and find the slingshot asset that's going to be the weapon for the enemy.

10:35.900 --> 10:39.470
Don't worry about trying to make that pouch stick to the hand.

10:39.470 --> 10:40.570
We'll do that later.

10:40.580 --> 10:49.220
For now, just make the basic goblin slingshot enemy blueprint and create and assign its animation blueprint,

10:49.220 --> 10:51.290
just like we did with the spear enemy.

10:51.320 --> 10:54.920
Go ahead and pause the video and conquer this quest now.

10:58.290 --> 11:03.000
Okay, So for this quest, we need another animation blueprint.

11:03.330 --> 11:11.880
I'm going to go into my content Blueprints character folder, and we'll make a new folder for the Goblin

11:11.880 --> 11:12.720
Slingshot.

11:12.720 --> 11:15.060
So we're going to right click new folder.

11:15.060 --> 11:18.690
We'll call this one goblin underscore Slingshot.

11:20.170 --> 11:22.540
And we'll make a new blueprint here.

11:22.540 --> 11:25.870
So, Blueprint class, we're going to choose Ora Enemy.

11:28.340 --> 11:29.480
Select.

11:29.810 --> 11:35.450
We'll call this BP goblin underscore Slingshot.

11:36.790 --> 11:40.810
We'll open that up and we just need to set that mesh.

11:40.810 --> 11:44.170
It's going to be the same mesh as the Goblin Spear.

11:44.200 --> 11:46.660
So I'm going to choose Goblin here.

11:48.050 --> 11:50.660
We're going to rotate it by 90 degrees.

11:52.020 --> 11:56.760
We'll drop it on down and make the capsule a bit smaller.

11:56.760 --> 12:04.290
Now, this is the same size, so I could just go to BP, Goblin Spear, take that capsule, see the

12:04.290 --> 12:06.270
capsule, half height and radius.

12:06.270 --> 12:08.730
That's about 51 and 28.

12:10.520 --> 12:15.770
So I'll put in 51 here and a 28 here.

12:16.490 --> 12:17.840
So that looks about right.

12:17.840 --> 12:19.790
We'll raise the mesh a bit.

12:20.780 --> 12:21.830
Perfect.

12:22.010 --> 12:25.910
Now we know that this mesh already has that hand socket.

12:25.940 --> 12:27.640
We just need to set the weapon.

12:27.650 --> 12:29.480
So I'm going to choose the weapon.

12:30.200 --> 12:31.910
I'm going to search for Slingshot.

12:31.910 --> 12:33.290
And there it is.

12:33.320 --> 12:35.150
We have the slingshot there.

12:35.180 --> 12:36.170
Okay, great.

12:36.170 --> 12:40.580
And right next to the blueprint, I'm going to make the animation blueprint.

12:40.580 --> 12:41.690
Going to animation.

12:41.690 --> 12:43.310
Animation Blueprint.

12:43.880 --> 12:46.790
Choose the parent class that's going to be an enemy.

12:46.820 --> 12:48.800
Our animation blueprint template.

12:48.800 --> 12:53.210
And here's the goblin as our skeleton.

12:53.210 --> 13:00.350
We're going to click Create, and I'll call this app underscore Goblin, underscore Slingshot.

13:01.240 --> 13:04.390
And this is going to be easy.

13:04.390 --> 13:11.230
All we have to do is open it up, go to asset override and toil down all the dropdowns until we get

13:11.230 --> 13:12.640
to the blend space player.

13:12.640 --> 13:22.330
And we can choose between Goblin, Slingshot, Idle run, compile that and now we have our animation

13:22.330 --> 13:23.190
blueprint.

13:23.450 --> 13:33.610
We can go back to our goblin slingshot, select the mesh and choose our anim class, which is a goblin

13:33.610 --> 13:35.260
slingshot now.

13:35.260 --> 13:37.480
And it's looking great now.

13:37.480 --> 13:39.460
The pouch is not in the hand.

13:39.490 --> 13:41.890
We would like that to be the case.

13:41.890 --> 13:43.150
We'll do that later.

13:43.180 --> 13:44.680
Don't worry too much about that.

13:44.680 --> 13:51.430
All that we care about now is that we have our goblin and we saw that we didn't have to go into the

13:51.430 --> 13:57.490
animation blueprint and set all the variables or anything like that because we're using the animation

13:57.490 --> 14:01.510
blueprint template and we can share that for our enemies.

14:01.510 --> 14:09.700
All we need to do is swap out the meshes and change whatever animation assets we're using here in the

14:09.730 --> 14:11.050
animation blueprint.

14:11.050 --> 14:12.970
And things are easy.

14:13.180 --> 14:19.180
All right, so now that we have our two different types of goblins, we can save all.

14:19.900 --> 14:26.440
And we're now ready to start handling player input, setting up enhanced input for our character, and

14:26.440 --> 14:28.690
we'll do all that good stuff next.

14:28.810 --> 14:29.710
I'll see you soon.
