WEBVTT

00:07.520 --> 00:08.660
Welcome back.

00:08.660 --> 00:14.720
In this video, we're going to fix a pesky issue that's been bothering me for the last couple videos.

00:14.720 --> 00:21.890
And that's if I have my circle showing and I'm aiming for the enemy.

00:21.890 --> 00:27.920
I get this weird, funky behavior because I'm tracing onto the enemy, and that's changing my impact

00:27.920 --> 00:31.820
point on my hit result, and that's really bothering me at this point.

00:31.820 --> 00:34.010
So I think we're going to fix it now.

00:34.010 --> 00:40.250
See if you can figure out a way to easily fix this, maybe brainstorm a bit, pause if you like, and

00:40.250 --> 00:42.680
see if you can figure out an idea.

00:42.950 --> 00:47.540
And if you feel like that is a good idea, maybe give it a try.

00:48.990 --> 00:57.750
What I'd like to do is I'd like to ignore enemies when I have a magic circle, when my magic circle

00:57.750 --> 01:04.800
is valid and we're tracing in the player controller, I'm going to go ahead and close all tabs and open

01:04.800 --> 01:08.190
Aura Player Controller and in Cursor Trace.

01:08.190 --> 01:13.140
Here we're getting the hit result under the cursor and we're tracing against the visibility channel.

01:13.410 --> 01:19.770
But we could trace against a different channel if our magic circle is valid if we have one.

01:19.770 --> 01:20.010
Right.

01:20.010 --> 01:26.760
So what I'd like to do is make a new collision channel that is basically like the visibility channel.

01:26.760 --> 01:30.600
Everything blocks it except for a few things like enemies.

01:31.170 --> 01:33.870
And perhaps this volume back here.

01:33.870 --> 01:40.620
And Ora and Ora's box that fades pieces of the environment out.

01:40.920 --> 01:42.270
So let's do that.

01:42.270 --> 01:47.490
I'm going to go into project settings, and I'm going to search for objects so I can create a new collision

01:47.490 --> 01:48.690
object channel.

01:48.720 --> 01:52.200
I'm going to add this and I'm just going to call this exclude.

01:52.810 --> 01:53.980
Players.

01:54.550 --> 02:01.270
As in this game, players refers to both aura and enemies, but I'd like everything else to block it,

02:01.270 --> 02:05.200
so its default response will be block and we'll accept that.

02:05.470 --> 02:13.780
So now that we have exclude players, we can start making things ignore this trace type such as this

02:13.780 --> 02:15.280
blocking volume here.

02:15.830 --> 02:19.760
Now I'm not seeing exclude players, so I'm going to restart the editor.

02:21.460 --> 02:25.090
And I'll go ahead and select this blocking volume here.

02:25.570 --> 02:27.580
And now I see exclude players.

02:27.580 --> 02:29.920
And I'm going to ignore that channel.

02:30.490 --> 02:35.530
Now I'm also going to ignore it for our enemies so we don't hit them with the trace.

02:35.530 --> 02:39.460
So I'm going to go into BP enemy base.

02:41.140 --> 02:46.450
This is why it's very useful to have a base blueprint class, because we can set these properties here.

02:46.450 --> 02:50.170
I'm going to set the capsule component to ignore exclude players.

02:50.170 --> 02:52.810
And I'm going to do that for the mesh as well.

02:52.810 --> 02:54.700
Ignore exclude players.

02:54.700 --> 02:57.700
And while we're at it we'll go ahead and do this for the weapon.

02:57.700 --> 03:03.010
The weapon can be custom and it will also ignore exclude players as well.

03:03.970 --> 03:12.070
On top of that, we're going to need to take care of Ora Ora's capsule is going to ignore exclude players.

03:13.140 --> 03:14.280
Or as mesh.

03:16.050 --> 03:17.280
We'll also ignore it.

03:17.280 --> 03:18.720
And Aura's weapon.

03:19.570 --> 03:23.560
Will also ignore exclude players.

03:23.560 --> 03:25.090
We'll set it to custom here.

03:25.670 --> 03:28.610
Now, in addition to that, we also have this box.

03:28.610 --> 03:33.980
This needs to ignore exclude players as well or we'll get some collisions with that.

03:34.130 --> 03:40.250
So with that we should now see that our goblin here should be ignoring it.

03:40.250 --> 03:44.960
So if we check its mesh, its mesh is ignoring exclude players as well.

03:44.960 --> 03:49.340
So now that we have this collision channel we can use this in C plus plus.

03:49.340 --> 03:54.170
So I'm going to save all those changes and go back into our player controller.

03:54.170 --> 03:56.540
And I'm also going to open Orosz.

03:56.540 --> 04:00.950
So we can have a macro symbol for our new collision channel.

04:00.950 --> 04:03.260
It's going to be Game Trace channel three.

04:03.260 --> 04:08.150
So I'm going to copy one of these lines, change it to Game Trace channel three.

04:08.150 --> 04:12.200
And I'm going to call this exclude players.

04:13.380 --> 04:14.790
Now we're going to use this.

04:14.790 --> 04:16.860
Let's go into our player controller.

04:17.480 --> 04:21.110
And what I'd like to do is make a const e collision channel.

04:22.600 --> 04:23.800
Variable.

04:23.800 --> 04:26.080
And I'm going to call this trace channel.

04:26.930 --> 04:31.430
And I'm going to set it equal to the result of a ternary operator.

04:31.940 --> 04:33.560
Checking is valid.

04:33.560 --> 04:35.090
My magic circle.

04:35.180 --> 04:36.890
So question mark here.

04:36.890 --> 04:42.680
And if the magic circle is valid I'm going to trace against AEK exclude players.

04:43.160 --> 04:48.170
And if our magic circle is not valid it's pending kill or null.

04:48.170 --> 04:55.340
Then I'll trace against AEK visibility and then I can pass trace channel straight into git hit result

04:55.340 --> 04:56.600
under mouse cursor.

04:56.600 --> 05:01.700
And now we'll be tracing against two different channels based on whether or not we have a magic circle.

05:03.050 --> 05:04.280
So with that.

05:04.860 --> 05:06.330
Let's try this out.

05:08.230 --> 05:08.800
All right.

05:08.800 --> 05:12.670
So I don't need oral character or BP enemy base anymore.

05:12.670 --> 05:15.070
And I can test this out.

05:15.070 --> 05:19.930
I can get my circle, I can trace, and I don't hit my enemy.

05:19.930 --> 05:22.600
If I go ahead and get rid of that circle.

05:22.600 --> 05:24.730
Now, I don't have a circle anymore.

05:24.730 --> 05:26.770
And I trace and I get the enemy.

05:27.070 --> 05:30.670
So trace works with no circle.

05:31.450 --> 05:36.640
Trace no longer works on enemies with the circle, but we're tracing against everything else, and that's

05:36.640 --> 05:41.650
why we can still set that destination for our circle.

05:42.100 --> 05:44.680
So that fixes that pesky problem.

05:45.630 --> 05:49.350
And really we're going to be aiming at enemies, right?

05:49.350 --> 05:55.530
So if we have a circle and we're looking to hurt some enemies, we're going to be aiming at them.

05:55.530 --> 05:59.850
So we don't need that jerkiness that jumpiness they're distracting us.

05:59.850 --> 06:05.220
And if you really wanted to highlight the enemies in red, well, you could do two traces.

06:05.220 --> 06:11.130
While you have your circle active, you can do one that traces against the Exclude Players channel,

06:11.130 --> 06:13.680
and then you can do another against visibility.

06:13.680 --> 06:18.630
And you can use the exclude players one for your circle.

06:18.630 --> 06:24.150
And then you could use the visibility trace for actually highlighting enemies.

06:24.150 --> 06:28.950
So I'm going to give that to you as an optional challenge if that's what you want.

06:28.950 --> 06:34.680
But I'm pretty happy with how this looks and how our gameplay mechanics are working.

06:34.680 --> 06:40.770
And I really just like how this little oblivious goblin looks inside of this circle.

06:40.770 --> 06:47.520
It's like looking around at the circle, like what's about to happen to me and or as like, well, this.

06:50.110 --> 06:51.130
Excellent job.

06:51.130 --> 06:52.300
I'll see you soon.
