WEBVTT

00:07.040 --> 00:08.160
Welcome back.

00:08.180 --> 00:14.300
Now we're just about ready to create blueprints based on aura, character and aura enemy.

00:14.660 --> 00:21.210
And we know that we can add things to aura character base, and these will both inherit those things.

00:21.230 --> 00:27.080
Now, I'd like all my characters to have a weapon, so I'm going to add a skeletal mesh component to

00:27.080 --> 00:33.830
the Aura character base, and I'd like to attach that to a socket on the skeleton, which means we'll

00:33.830 --> 00:38.570
need to make sure that our skeletal meshes have the socket that we specify.

00:38.750 --> 00:44.660
So in our protected section in Aura character base, I'm going to make a weapon, which is a skeletal

00:44.660 --> 00:53.480
mesh component pointer, and I'm going to use the T object pointer wrapper rather than a raw use skeletal

00:53.480 --> 00:54.930
mesh component pointer.

00:54.950 --> 01:00.950
Now, T object pointer is relatively new in unreal engine and a packaged build.

01:00.950 --> 01:07.380
It behaves the same as a raw pointer, but in editor it has some additional features, such as access

01:07.380 --> 01:10.530
tracking and optional lazy load behavior.

01:10.950 --> 01:16.950
Access tracking just means we can track how often a pointer is accessed or dereferenced.

01:16.950 --> 01:25.260
And lazy loading means that an asset can not be loaded until it's actually needed or used in the program.

01:25.260 --> 01:31.170
So the standard is moving more towards using object pointers for member variables.

01:31.170 --> 01:34.260
So we'll be following that standard in this project.

01:34.260 --> 01:39.450
And object pointer in this case will wrap a used skeletal mesh component.

01:39.480 --> 01:41.310
There's no need for the asterisk.

01:41.310 --> 01:47.550
We don't need to add that star, but we know that this is a pointer and we'll call this weapon.

01:48.060 --> 01:56.010
And I'm going to make this a uproperty as all of our member pointers should be, and we'll make this

01:56.010 --> 02:01.470
edit anywhere and I'll place it in the category of combat.

02:02.070 --> 02:09.270
So now we can actually create our skeletal mesh component in or a character base in the constructor.

02:09.270 --> 02:17.370
So we'll say weapon equals and we'll use create default subobject here specifying the use skeletal mesh

02:17.370 --> 02:21.870
component and in quotes we'll have simply weapon.

02:22.110 --> 02:28.380
Now, if you're asking why I haven't used the text macro here, that's because create default Subobject

02:28.410 --> 02:32.520
takes an F name and you don't need the text macro for F names.

02:32.520 --> 02:34.440
You need them for f strings.

02:34.470 --> 02:40.980
F string will take a string literal like this and perform an implicit conversion to a wide character

02:40.980 --> 02:44.880
string as that's what the f string type stores.

02:44.880 --> 02:49.290
But the F name can take a regular string literal just like this.

02:49.470 --> 02:57.600
Now I'd like to attach the weapon to a socket on the mesh, so I'm going to say weapon setup attachment.

02:57.750 --> 03:06.240
We'll attach it to the mesh so we'll access that through get mesh that's inherited from the A character

03:06.240 --> 03:07.380
class, of course.

03:07.380 --> 03:10.260
And we'll attach it to a socket.

03:10.260 --> 03:16.050
So I'm going to use an F name here and we're going to add a socket to the skeleton.

03:16.050 --> 03:18.690
We'll call this weapon hand socket.

03:18.690 --> 03:24.420
So we'll place a socket on one of the hands and our weapon will be attached to that.

03:24.420 --> 03:27.120
And the weapon should not have any collision.

03:27.120 --> 03:29.280
So I'm going to take the weapon and call.

03:29.280 --> 03:31.540
Set collision enabled using E!

03:31.560 --> 03:32.910
Collision enabled.

03:32.940 --> 03:34.320
No collision.

03:34.950 --> 03:37.620
So that should take care of collision.

03:37.620 --> 03:44.010
So now if we go and create some blueprints based on a character and or an enemy, they will have the

03:44.010 --> 03:49.200
weapon skeletal mesh component and we can set the skeletal mesh in the blueprint.

03:49.230 --> 03:55.320
Now, I'm not debugging any code, so I'm just going to hit run to compile and launch the editor.

03:55.930 --> 03:59.980
And with the editor open, I can now start making some blueprints.

04:00.010 --> 04:02.890
Now, I don't want things to be messy.

04:02.890 --> 04:05.740
I want a nice clean folder structure.

04:05.740 --> 04:10.330
So I'm going to have a new folder in content designated for all my blueprints.

04:10.330 --> 04:11.860
And I'll call it blueprints.

04:12.100 --> 04:16.650
And inside of blueprints I'll make a new folder called Character.

04:16.660 --> 04:22.660
And here in character, I'll have the Aura character as well as all my enemy characters.

04:22.660 --> 04:29.260
So here in character, I'll make an aura folder, and in Aura I'll make the aura blueprint.

04:29.260 --> 04:34.480
So I'm going to right click and make a new blueprint class and search for Aura character.

04:34.480 --> 04:36.430
I don't want Aura character base.

04:36.430 --> 04:38.350
I want my Aura character.

04:38.350 --> 04:47.650
So I'll select that and call this BP underscore aura character and we can go ahead and open it and set

04:47.650 --> 04:52.000
the mesh for the mesh variable as well as our weapon.

04:52.090 --> 04:53.620
So first the mesh.

04:53.620 --> 04:58.370
I'll take my skeletal mesh asset and right here we have Sxm aura.

04:58.400 --> 05:00.410
That's the aura skeletal mesh.

05:00.410 --> 05:01.670
I can move it down.

05:01.670 --> 05:06.020
I'd like snapping enabled for translation and rotation.

05:06.020 --> 05:11.300
I'll move it about 90 units down and exactly 90 units rotated.

05:11.300 --> 05:14.480
So it's forward and we can set our weapon.

05:14.480 --> 05:19.640
Before we do that, I'm going to add that socket that we called weapon hand socket.

05:19.640 --> 05:24.680
I'm going to actually copy that name and I'll take my aura.

05:24.710 --> 05:31.160
Let's browse to that and open it up and choose where we want the hand socket.

05:31.190 --> 05:35.150
Now the question is, do we want this on the left or right hands?

05:35.150 --> 05:39.860
And the animations that we have for aura, use the left hand.

05:39.890 --> 05:47.630
We can see that by going into the animations folder here in the same folder that Sxm aura exists in.

05:47.630 --> 05:50.990
And we can just take a look at, say, the idle animation.

05:50.990 --> 05:55.460
We can see that aura holds the weapon in the left hand.

05:55.670 --> 06:00.110
So back in Sxm aura, I'm going to add a socket to handle.

06:00.140 --> 06:02.330
That's the handle bone.

06:02.690 --> 06:04.340
We're going to add a socket.

06:04.340 --> 06:05.210
I'm going to click it.

06:05.210 --> 06:09.350
I'm going to click it again and paste in weapon hand socket.

06:09.860 --> 06:17.450
That way it has the correct name and we can position that socket by right clicking and adding a preview

06:17.450 --> 06:20.420
asset, searching for the staff.

06:20.480 --> 06:24.680
I'm going to get that skeletal mesh asset Sxm staff.

06:24.710 --> 06:26.840
The staff is the static mesh.

06:26.840 --> 06:33.140
I want the skeletal mesh and I'm going to go ahead and rotate it by about 90 degrees.

06:33.260 --> 06:39.800
And I want to preview this with an animation so I know that I'm positioning things correctly.

06:39.800 --> 06:45.380
So up here under animation, I can set preview controller to use specific animation.

06:45.380 --> 06:48.920
And for the animation I can choose any one of these.

06:48.950 --> 06:54.200
I'll choose Firebolt here and we have Aura casting a spell.

06:54.200 --> 07:02.480
I'm going to pause it somewhere in the middle and move this socket so that it looks correct.

07:02.510 --> 07:06.680
I'll move it forward a bit and just make sure that it looks good.

07:07.100 --> 07:08.690
I think that looks pretty nice.

07:08.690 --> 07:14.480
And I can switch to, say, the idle animation if I want to make sure it looks good there and perform

07:14.480 --> 07:16.100
any last minute tweaks.

07:16.280 --> 07:19.400
So I might actually angle it forward a bit.

07:19.400 --> 07:22.970
Let's take snapping and disable that for rotation.

07:23.920 --> 07:25.870
And just make sure it looks good.

07:27.700 --> 07:28.660
Okay, great.

07:28.660 --> 07:29.860
So we have the socket.

07:29.890 --> 07:36.490
We can go back to our character, select the weapon, and we can set that skeletal mesh.

07:36.880 --> 07:44.380
I'm going to search for staff and we have Sqms staff and we see that it's attached to the correct socket.

07:44.380 --> 07:48.820
And if you want to see that staff, just browse to it and inspect it.

07:48.850 --> 07:53.230
It's got some nice textures on it, really pretty staff.

07:53.230 --> 07:55.420
So that's going to be aughra's weapon.

07:55.840 --> 07:56.890
Okay, great.

07:56.890 --> 08:01.540
So we have the Aura character blueprint and that looks great.

08:01.570 --> 08:05.350
We can also make a blueprint for the enemy class.

08:05.350 --> 08:08.530
We'll go ahead and make one of those before we wrap it up.

08:08.560 --> 08:12.040
And that's actually going to be your quest.

08:12.040 --> 08:16.330
So for this quest, you're going to make a blueprint for the Goblin Enemy.

08:16.330 --> 08:25.720
Call it Goblin Spear now set the mesh and search for the goblin skeletal mesh in our assets folder and

08:25.720 --> 08:27.740
check out the skeleton on that goblin.

08:27.740 --> 08:34.790
Make sure you take care of the socket and then you can find the spear asset and set that for the weapon

08:34.790 --> 08:36.650
on the goblin blueprint.

08:36.680 --> 08:42.080
Go ahead and pause the video here and take care of making the Goblin Spear blueprint.

08:45.130 --> 08:47.330
Okay, so let's conquer this quest.

08:47.350 --> 08:54.940
I'm going to go into my character's folder and next to Aura, I'm going to make a new folder and I'll

08:54.940 --> 08:58.830
call this goblin underscore spear.

08:58.840 --> 09:05.080
And in Goblin Spear, I'll right click and make a new blueprint based on aura Enemy.

09:05.080 --> 09:13.270
So I'll choose that class and call this beep, underscore goblin, underscore spear, and I'm ready

09:13.270 --> 09:16.450
to open it up and set the mesh.

09:16.630 --> 09:20.710
So I'll select the mesh and search for Goblin.

09:20.710 --> 09:21.820
In fact, it's right here.

09:21.820 --> 09:23.470
I can go ahead and select it.

09:23.470 --> 09:27.760
I can move it down, I can rotate it by 90 degrees.

09:27.760 --> 09:29.680
I don't have snapping on it looks like.

09:29.680 --> 09:34.390
So I'm going to undo that, enable snapping and rotate by 90 there.

09:34.510 --> 09:36.610
Now this is a little guy.

09:36.610 --> 09:39.820
We can make that capsule a bit smaller.

09:39.820 --> 09:42.940
So we'll go ahead and just bring it in a bit.

09:42.940 --> 09:45.650
Just a cute little goblin enemy.

09:45.860 --> 09:53.090
It's going to be really sad to kill these guys, but that's the price you have to pay to be a hero,

09:53.090 --> 09:53.690
right?

09:53.690 --> 09:56.150
So I have my goblin.

09:56.150 --> 09:58.130
It needs a weapon as well.

09:58.130 --> 10:00.830
So let's take care of the socket situation.

10:00.830 --> 10:05.900
I'm going to browse to goblin, open it up and look at that.

10:05.900 --> 10:09.620
We do have a socket on the left hand bone.

10:09.620 --> 10:16.760
Now I'd like to see what it looks like with a spear so I could right click, add a preview asset and

10:16.760 --> 10:19.820
search for spear and choose the spear.

10:19.850 --> 10:21.680
That's the skeletal mesh component.

10:21.680 --> 10:29.030
Looks like it's in the correct location and we can set the preview controller to use specific animation

10:29.030 --> 10:32.630
and see if we have any spear attack animations.

10:32.630 --> 10:36.890
Looks like we have attack spear and it looks pretty good.

10:36.890 --> 10:40.400
I don't think we need to really do any adjustments on that.

10:40.430 --> 10:46.700
Thanks to the creator of these assets positioning that socket correctly for us.

10:46.700 --> 10:47.900
All right.

10:47.930 --> 10:51.850
Now we do need to make sure that that socket name is correct.

10:51.860 --> 10:53.630
Hopefully this didn't trip you up.

10:53.630 --> 10:56.300
It needs to be weapon hand socket.

10:56.300 --> 11:00.290
So we are going to need to rename this socket.

11:01.800 --> 11:06.690
I'm going to paste in weapon hand socket and save that.

11:06.690 --> 11:10.880
And now in Goblin Spear, I can select weapon.

11:10.890 --> 11:16.710
I can search for spear and set that weapon to the spear and it looks good.

11:16.890 --> 11:23.340
So now we have a weapon based on aura enemy called Goblin Spear.

11:23.340 --> 11:28.320
And if you'd like to see what they look like next to each other, if you're curious, you could drag.

11:28.320 --> 11:32.190
In an instance of these blueprints.

11:32.190 --> 11:33.840
I can browse to Aura.

11:35.780 --> 11:40.310
Drag aura in there, and I can browse to the goblin.

11:41.400 --> 11:43.170
And drag in the goblin.

11:43.170 --> 11:48.120
And as you can see, the goblin is a good deal shorter than aura.

11:48.360 --> 11:51.270
So that gives you an idea of what they look like.

11:51.300 --> 11:56.400
I'll go ahead and delete those, however, I don't need them in the world just yet.

11:56.400 --> 11:59.790
And now we have some characters to work with.

11:59.790 --> 12:00.660
Excellent.

12:00.690 --> 12:04.980
I'll go ahead and save all before I close out of the editor.

12:05.370 --> 12:11.550
And we're now ready to create some animation blueprints for our characters and we'll do those next.

12:11.790 --> 12:12.810
I'll see you soon.
