WEBVTT

00:06.850 --> 00:07.900
Welcome back.

00:07.930 --> 00:14.890
Now we've created an environment query and we have an X testing Pon that's testing that query and it's

00:14.890 --> 00:21.760
showing some debug locations for us for each of those items generated by our generator.

00:21.790 --> 00:28.600
Now our generator is generating a path in grid generating around the query or the query for being,

00:28.600 --> 00:30.790
in this case, the testing Pon.

00:30.820 --> 00:38.200
Now we can run tests on all of the points generated by our generator and we can add those tests pretty

00:38.200 --> 00:42.190
easily by right clicking on the generator and selecting add test.

00:42.190 --> 00:44.780
And we have a few different types of tests.

00:44.800 --> 00:46.590
One of those is the trace.

00:46.600 --> 00:49.120
I'd like to check out that one first.

00:49.300 --> 00:56.620
Now the trace is going to trace for each of these points to some kind of destination that we choose,

00:56.620 --> 01:00.730
and by default, it traces against the visibility channel.

01:00.730 --> 01:08.060
So if we click on the blue Trace to query or on visibility, we see the details for this given test.

01:08.060 --> 01:11.300
And under test, we see test purpose.

01:11.330 --> 01:16.220
Now the test purpose is what determines what we do with each point.

01:16.250 --> 01:17.960
Do we want to filter them out?

01:17.990 --> 01:21.710
Do we want to score them or do we want to do both?

01:21.770 --> 01:26.620
Now a trace is a sort of yes or no question.

01:26.630 --> 01:31.970
If we trace to some target, can we hit that target or is something in the way?

01:31.970 --> 01:33.980
That's what the trace is really good for.

01:34.010 --> 01:43.310
So we can choose to have this filter out all points that cannot trace to a given target or the opposite.

01:43.340 --> 01:45.920
We can filter out all points that can.

01:45.920 --> 01:53.590
So I'm going to change this to filter only and we can trace to a target in the test details panel.

01:53.600 --> 02:00.680
The target is called a context, or we can trace from the context to each given point.

02:00.710 --> 02:08.720
Now the context by default is set to environment query context Querier, which means that we'll be tracing

02:08.750 --> 02:10.580
to the querier.

02:10.580 --> 02:14.390
And in our case, we just have this testing pawn here.

02:15.550 --> 02:21.220
The testing pawn doesn't really have any components that will block the visibility channel.

02:21.220 --> 02:27.460
So a trace doesn't mean a whole lot when we don't have a context that we can trace and hit.

02:27.880 --> 02:31.140
But we don't have to trace to the querier.

02:31.150 --> 02:36.710
We don't have to trace to the testing pawn or the pawn that owns this environment query.

02:36.730 --> 02:38.710
We can choose any context we want.

02:38.740 --> 02:46.450
In fact, a context is a class that we can make and determine exactly what we're going to trace to.

02:46.480 --> 02:55.570
So we're going to create a environment query context and define exactly what it is we'd like to trace

02:55.570 --> 02:56.140
to.

02:56.410 --> 03:03.580
So to make an environment query context, we're going to go into i x our X folder, we're going to right

03:03.580 --> 03:06.360
click, create a Blueprint class.

03:06.370 --> 03:15.860
And the class that we're interested in is e env query context and we need environment query context,

03:15.860 --> 03:19.880
blueprint base or env query context blueprint base.

03:19.880 --> 03:21.110
Let's select that.

03:21.140 --> 03:31.430
Now we have a environment query context and I'm going to name this X underscore player context.

03:31.640 --> 03:40.820
So I'd like this context to determine exactly what we should be able to trace towards and try to hit.

03:40.850 --> 03:48.800
So I'm going to open up my X player context and the way that we determine what this context returns

03:48.830 --> 03:53.180
is, we override a function called provide actor set.

03:53.210 --> 03:59.390
We can also provide location set, and we're going to return a set of actors or locations.

03:59.390 --> 04:04.220
We could also provide a single actor or a single location if we wanted to do that.

04:04.250 --> 04:10.760
We're going to choose provide actor set and notice that we return an array of actor object references.

04:10.910 --> 04:12.410
This is going to be pretty simple.

04:12.410 --> 04:16.070
We're going to use get all actors of class.

04:17.020 --> 04:20.800
And we're going to filter this by our Aura class.

04:20.800 --> 04:24.640
We're going to use BP, underscore aura character.

04:25.670 --> 04:28.580
So we're going to get all actors of the Aura character class.

04:28.580 --> 04:31.010
So this is not a very expensive operation.

04:31.010 --> 04:38.090
We only have one or in the case of a multiplayer game, perhaps several, but we won't have that many.

04:38.090 --> 04:39.620
So we're going to return that.

04:39.620 --> 04:46.760
So this context returns an array of all actors of the BP Aura character class.

04:46.760 --> 04:48.650
I'm going to compile and save that.

04:48.650 --> 04:56.780
And now if I go back to my environment query with my trace, I can change this context to ex player

04:56.780 --> 04:57.740
context.

04:57.740 --> 05:02.660
And now look, it's tracing to ex player context on visibility.

05:02.660 --> 05:04.070
What happens then?

05:04.070 --> 05:05.980
Well, let's go back to our map.

05:05.990 --> 05:10.670
Notice that all of these are red and they have a score of zero.

05:10.700 --> 05:12.410
That's what these numbers are.

05:12.410 --> 05:13.520
They're the score.

05:13.550 --> 05:18.320
Well, that's because there's no aura character to trace to.

05:18.470 --> 05:20.360
But we can grab an aura character.

05:20.360 --> 05:26.850
We can go to blueprints, character, aura and drag in a BP or a character.

05:26.850 --> 05:29.430
Let's go ahead and grab one of those, drag it in.

05:31.390 --> 05:36.220
So now we have an aura character in the world that our items can trace to.

05:36.220 --> 05:42.600
And I'm going to select my testing pawn and just move it up a little bit above the ground just a bit.

05:42.610 --> 05:47.770
And that way we can make sure that our points are not going to trace and hit the ground.

05:48.520 --> 05:50.650
Okay, so we're performing a trace.

05:50.950 --> 05:56.950
And if we go back to our environment query, we have something called Bool Match.

05:57.040 --> 06:03.850
Now this boolean value is what we use to determine whether we want to filter things out or keep them

06:03.850 --> 06:05.890
in based on this trace.

06:05.920 --> 06:09.400
If we uncheck it and go back, notice all the points are red.

06:09.430 --> 06:13.450
If we check bool, match and go back, all the points are blue.

06:13.540 --> 06:15.000
So which one is which?

06:15.010 --> 06:17.170
Which one is the hit and which one is not?

06:17.200 --> 06:23.490
Well, we can figure that out pretty easily by dragging in some geometry to block the way.

06:23.500 --> 06:30.070
I'm going to go to assets and dungeon and let's get a wall or a cube of some kind.

06:30.100 --> 06:31.790
Here's a static mesh tile.

06:31.790 --> 06:33.440
Three by three by three.

06:34.680 --> 06:35.820
I'm going to bring that in.

06:35.820 --> 06:37.350
It's actually quite large.

06:37.350 --> 06:41.400
And then I'll select my testing pawn and I'll move it just slightly.

06:41.580 --> 06:44.640
And after I move it slightly, we've kicked it into gear.

06:44.670 --> 06:49.930
Sometimes you have to move it a little bit to update it when the environment changes.

06:49.950 --> 06:52.530
So now check out what's happening.

06:53.960 --> 06:58.940
We have a number of points here and some of them are blue and some of them are red.

06:58.970 --> 07:03.440
Now, looking back at my environment query bool match is set to false.

07:03.470 --> 07:06.050
If I check that, change it to true.

07:06.080 --> 07:12.470
Now we'll see that most of these points are blue and the points that would not hit the player, the

07:12.470 --> 07:15.410
ones that are blocked by this geometry are red.

07:15.440 --> 07:22.070
So if we only want the points that can see the player, the points that can trace to the player unblocked,

07:22.100 --> 07:26.510
we're going to want to set that boolean to false.

07:26.630 --> 07:33.530
And then we get all those points that can trace to the player and not hit something in the way.

07:34.380 --> 07:35.190
Okay.

07:35.340 --> 07:42.210
Now notice that some of the points are inside and those ones actually are able to trace to aura.

07:42.240 --> 07:47.640
They're not hitting something because this static mesh isn't blocking from the inside.

07:47.640 --> 07:49.680
So that's something to be aware of.

07:49.710 --> 07:58.650
You have to keep in mind that this grid can contain points that may be inside of geometry.

07:59.380 --> 08:03.790
So we really don't want any points that could be inside of some geometry.

08:03.790 --> 08:04.420
Right?

08:04.420 --> 08:07.630
So there are a couple of things we can do about that.

08:07.840 --> 08:10.330
For one, I'm going to take this cube.

08:10.330 --> 08:13.270
I'm going to right click on it and edit it.

08:13.300 --> 08:17.980
Now, this cube may or may not have simple geometry.

08:18.010 --> 08:21.970
We can click on show and choose simple collision.

08:21.970 --> 08:27.130
And if we don't see any green collision volumes, then we don't have any simple collision.

08:27.130 --> 08:34.270
We can go up to collision and add box simplified collision to add a simple collision that's going to

08:34.270 --> 08:37.360
affect any NAV mesh bounds volume.

08:37.390 --> 08:44.500
On top of that, we don't have a nav mesh, so we can go into the dropdown and go to volumes and drag

08:44.500 --> 08:46.330
in a nav mesh bounds volume.

08:47.630 --> 08:51.710
And we can scale up that nav mesh bounds volume here.

08:52.900 --> 08:59.860
And if I press P, I can see the extent of that nav mesh and we can see that now this block is putting

08:59.860 --> 09:01.240
a hole in the nav mesh.

09:01.240 --> 09:08.200
So now that we have that, if I select my testing pawn and move it just a bit, we'll now see that there

09:08.200 --> 09:11.980
are no points generated because it's a pathing grid.

09:11.980 --> 09:19.300
Pathing has to do with pathfinding, which has to do with AI, which uses the NAV mesh bounds volume.

09:19.300 --> 09:27.460
So pathing grid is not going to give us any points that are not navigable, something that an AI character

09:27.490 --> 09:29.350
could not walk on.

09:29.350 --> 09:31.380
So that's something to be aware of.

09:31.390 --> 09:38.770
So now that we know how to run tests on the different items generated by our generators, we're going

09:38.770 --> 09:46.420
to want to run more tests because we want to filter out all of these points for the best one.

09:46.420 --> 09:53.150
We want to get one that is ranked better than all the others, and we're going to do that by scoring

09:53.150 --> 09:55.610
the points, and we'll do that in the next video.

09:55.610 --> 09:59.000
So great job and I'll see you in the next video.
