WEBVTT

00:06.920 --> 00:07.970
Welcome back.

00:08.500 --> 00:14.710
Now our projectiles are looking pretty good, but we do have a couple minor issues, specifically with

00:14.710 --> 00:15.520
collision.

00:15.640 --> 00:22.900
If I just hold shift and click over here, you'll see that my fireball hits one of our potions.

00:22.900 --> 00:26.770
And not only is the potion consumed, but the fireball explodes.

00:26.770 --> 00:29.260
And neither of those are what we want.

00:29.410 --> 00:34.000
Now, if you've done any playtesting, you'll probably realize that the projectile will go straight

00:34.000 --> 00:37.160
through some things and not collide with them at all.

00:37.180 --> 00:41.470
So we need to sort out our collision for our projectiles.

00:41.500 --> 00:48.340
Now, in the case of this pillar here, really all we need to do is make sure that the pillar generates

00:48.340 --> 00:49.800
overlap events.

00:49.810 --> 00:56.290
So if we search for, generate and check, generate overlap events on our pillar.

00:57.060 --> 01:05.160
Then that right there should solve the problem of not blocking or overlapping with our projectiles.

01:05.280 --> 01:09.920
But what about this whole business of projectiles hitting our pickups?

01:09.930 --> 01:18.780
Well, our pickups are set to overlap with certain types, certain object types, and our projectiles

01:18.810 --> 01:21.330
are set to overlap certain object types.

01:21.330 --> 01:28.650
And if we look at our firebolt and check out our sphere, we'll see that the sphere is a world dynamic

01:28.650 --> 01:34.650
object type and it's set to overlap with world static, world dynamic and pawn.

01:34.800 --> 01:43.230
But most of the things in our world are either world static or world dynamic, including something like

01:43.260 --> 01:44.040
our potion.

01:44.040 --> 01:51.210
If we edit Mana potion, for example, we can take that box and see its collision object type.

01:51.210 --> 01:57.970
If we expand Collision Presets, it's a world dynamic, so we need another collision object type that

01:57.970 --> 02:01.450
we can distinguish from world static and world dynamic.

02:01.450 --> 02:03.790
Those are most of the things in our world.

02:03.880 --> 02:11.410
But I think something like a projectile object type would be great because then our potions and other

02:11.410 --> 02:18.370
pickups can ignore that object type, whereas certain other objects can block or overlap it.

02:18.370 --> 02:24.550
So we're going to make a custom object type, and we do that by going to edit and project settings,

02:24.550 --> 02:29.020
and we can simply search for object and we have object channels.

02:29.020 --> 02:35.830
And if we select new object channel, we can give our new channel a name and a default response.

02:35.860 --> 02:40.300
Now for the name we're going to call this object type projectile.

02:40.780 --> 02:46.780
And the default response for it could be ignore, overlap or block.

02:46.870 --> 02:51.100
Now our projectile is made to overlap with things.

02:51.190 --> 02:53.860
It's never really going to block anything.

02:53.860 --> 03:02.530
Now those things it does want to overlap with are namely world static, world dynamic and pawn everything

03:02.530 --> 03:05.070
else it's really going to ignore.

03:05.080 --> 03:12.760
So by default we can set its response to ignore and then manually set any components that have this

03:12.760 --> 03:16.720
type to have responses to the other types that we choose.

03:16.720 --> 03:22.660
So I'm going to go ahead and call this projectile default response, ignore and accept.

03:22.750 --> 03:30.820
Now, it's handy to be able to access this collision response channel in C plus plus, and for that

03:30.820 --> 03:38.110
reason I usually go into C plus plus and make some kind of constant or macro symbol that represents

03:38.110 --> 03:38.740
this.

03:38.740 --> 03:45.520
So what I'm going to do real quick is just save all and close and back here in the editor, I'm going

03:45.520 --> 03:54.160
to go into my aura dot h and here in Aura H where we defined our custom depth read symbol, we're also

03:54.160 --> 03:58.330
going to define our projectile collision channel.

03:58.330 --> 04:00.970
So we're going to use a define.

04:00.970 --> 04:08.050
So pound sign, define, and I'm going to call this EQ for a collision channel.

04:08.060 --> 04:09.910
We're going to call this projectile.

04:09.910 --> 04:21.820
And what we're defining it to be is a collision channel, EQ game, Trace Channel one.

04:21.940 --> 04:28.090
And that's because when we create a custom channel for the first time, it occupies Game Trace Channel

04:28.090 --> 04:29.590
one by default.

04:29.590 --> 04:33.700
If we created another one, that next one would be Channel two.

04:33.910 --> 04:40.510
So now we have this EQ projectile and we can choose to ignore or overlap with it.

04:40.540 --> 04:45.370
Now our aura effect actor should ignore this channel by default.

04:45.370 --> 04:51.790
So what we can do is for our overlap volumes that we add to our effect actors, we can make them ignore

04:51.790 --> 04:52.720
this channel.

04:52.930 --> 04:56.080
So I'm going to go ahead and compile and run this.

04:57.850 --> 05:00.190
And back here in the editor.

05:01.070 --> 05:03.200
I've got my mana potion still open.

05:03.200 --> 05:10.070
I can take its box component and for its collision presets we can set this to custom and then I can

05:10.070 --> 05:17.300
ignore the projectile which it's set to ignore already because we made it a default ignore response.

05:17.300 --> 05:23.000
So really anything we want to overlap with it, we have to manually set that to overlap such as our

05:23.000 --> 05:23.960
pillar here.

05:24.050 --> 05:27.530
If I search for collision, let's see what we've got here.

05:27.530 --> 05:33.740
We've got collision presets and projectile is set to ignore, but we want to overlap with it, so we'll

05:33.740 --> 05:34.910
check overlap.

05:35.530 --> 05:41.590
And now we can go into our firebolts and select our Firebolts sphere component.

05:41.590 --> 05:47.410
And down here in Collision we see that it has its object type set to world dynamic.

05:47.440 --> 05:52.390
This should be set to projectile, but we should also set this on the C plus plus side as well.

05:52.600 --> 06:00.910
So let's go to Aura Projectile CP and up at the top we're going to set the collision object type here.

06:00.910 --> 06:03.400
So we're going to say sphere.

06:04.870 --> 06:12.550
Set collision object type and it's going to be XY projectile.

06:12.790 --> 06:19.990
Now, as soon as I did, this writer included Aura dot H, because that's where this is defined.

06:20.020 --> 06:24.470
So make sure you include that if you're using XY projectile somewhere.

06:24.490 --> 06:27.250
If you don't have auto include like this.

06:27.790 --> 06:30.760
So now our sphere is set to the projectile.

06:30.760 --> 06:32.770
Now we did set this in Blueprint as well.

06:32.770 --> 06:36.640
So next time we compile that C plus plus change will take effect.

06:36.640 --> 06:39.840
But I set it here in the blueprint, so we're covered there.

06:39.850 --> 06:43.960
So now we should be able to ignore those potions.

06:44.610 --> 06:46.860
We should be able to go straight through them.

06:50.470 --> 06:51.660
Like so.

06:51.670 --> 06:55.840
But we do want our enemies to block, right?

06:55.840 --> 06:57.620
We don't want to go straight through the enemy.

06:57.640 --> 07:01.420
So we do want the enemies to block the projectile object type.

07:01.450 --> 07:10.810
So for that reason, we can go into character and enemy base where we can take our enemy's mesh and

07:10.810 --> 07:15.250
scroll down and make sure that it's set to overlap the projectile.

07:15.250 --> 07:19.540
And this is something that our base character should also have set in C plus plus.

07:19.540 --> 07:25.840
So we'll go to character or a character base where we're setting our mesh collision response to the

07:25.840 --> 07:27.760
camera channel to ignore.

07:27.760 --> 07:32.680
We should also set its collision response to projectile to overlap.

07:32.680 --> 07:34.360
So we'll say git mesh.

07:36.170 --> 07:44.810
Set collision response to channel and the channel will be e cc projectile.

07:45.620 --> 07:53.120
And again we got ora h included there and the response will be e cr overlap.

07:54.830 --> 07:57.230
And now all enemies should overlap.

07:57.230 --> 08:04.580
And if we want, say, PvP, then two aura characters playing in multiplayer together, shooting fireballs

08:04.580 --> 08:05.450
at each other.

08:05.480 --> 08:08.330
They will also be overlapping the projectile type.

08:09.600 --> 08:15.450
Now, if we go back into the editor and we launch a fireball at an enemy, we expect that fireball to

08:15.450 --> 08:16.170
blow up.

08:16.170 --> 08:18.180
But we see that it does not.

08:18.540 --> 08:23.080
And that's because we also need our mesh to generate overlap events.

08:23.100 --> 08:30.860
So if I check that now, if I launch a fireball at the enemy, I expect to see it blow up and it does.

08:30.870 --> 08:38.190
So this is another important property that we need set and it should also be set in C plus plus.

08:38.610 --> 08:43.080
So again, on a character base, we're going to take our mesh.

08:43.260 --> 08:48.150
So get mesh and we're going to set generate overlap events.

08:48.150 --> 08:52.230
So call set, generate overlap events passing in.

08:52.230 --> 08:52.860
True.

08:53.490 --> 08:59.100
And again, next time we compile that change will show up in the editor, but we set it in the blueprint

08:59.100 --> 09:01.950
as well for BP enemy base.

09:03.900 --> 09:08.880
So now we're getting more along the lines of the behavior we want.

09:08.910 --> 09:11.320
We can launch a fireball.

09:11.340 --> 09:12.930
It'll go through all pickups.

09:12.930 --> 09:20.130
It's not going to generate overlap events for them, but it will hit our enemy and blow up on the enemy.

09:20.130 --> 09:22.950
And that is exactly what I wanted.

09:23.250 --> 09:24.270
Perfect.

09:24.860 --> 09:29.570
So now that we've sorted out collision for our projectiles, we can continue.

09:29.600 --> 09:31.310
I'll see you in the next video.
