WEBVTT

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

00:08.270 --> 00:15.290
Now, one of the last things I'd like to cover in this section is what happens when we run behind things.

00:15.320 --> 00:20.690
We have obstacles sometimes, and the default behavior is for the camera to zoom in.

00:20.720 --> 00:23.720
Now, for some types of games, that's fine.

00:23.720 --> 00:24.770
I like that.

00:24.770 --> 00:30.440
But for other types of games, in particular the top down genre, that's not fine.

00:30.440 --> 00:31.470
I don't like it.

00:31.490 --> 00:34.340
I'd like the camera to be essentially fixed.

00:34.340 --> 00:39.320
I mean, it follows the character, but a fixed camera is not going to zoom in.

00:39.620 --> 00:46.610
It's going to stay back, which means that there might be geometry obstructing the view.

00:46.910 --> 00:53.930
So I'm going to make all of my geometry in the world, ignore the camera.

00:53.960 --> 01:01.850
So it's kind of convenient that all of my meshes here are in the same folder as I can just change all

01:01.850 --> 01:02.780
of them at once.

01:02.780 --> 01:09.870
So selecting all of them, I can go to their collision settings and just have them all ignore the camera

01:09.870 --> 01:10.500
channel.

01:10.500 --> 01:17.550
So we're going to go to Collision Presets, set them all to custom and have them all ignore the camera.

01:17.550 --> 01:22.350
And now if I press play, they're not going to block the camera.

01:22.350 --> 01:24.240
But now they're blocking our view.

01:24.240 --> 01:26.130
And that's not good either, right?

01:26.130 --> 01:29.220
So how do we get around this problem?

01:29.660 --> 01:34.520
Well, what a lot of top down games do is they fade out the geometry.

01:34.640 --> 01:42.260
That's the kind of approach that I like because as you're moving behind something, that obstacle fades

01:42.260 --> 01:43.760
out and you can see through it.

01:43.760 --> 01:44.960
That's kind of cool.

01:44.960 --> 01:47.780
And so we're going to come up with that kind of a solution.

01:47.780 --> 01:52.370
Now, something like this tunnel here is a prime example of why we'd want this.

01:52.370 --> 02:00.440
In fact, if we just delete these two pieces and duplicate these shorter pieces and use those instead,

02:00.470 --> 02:04.100
then select everything and move it down a bit.

02:04.130 --> 02:08.420
Now we can see that the problem becomes even more of a concern.

02:08.420 --> 02:17.150
So I'd like to handle creating some kind of actor that we can use to dynamically fade out itself.

02:17.300 --> 02:19.640
So we're going to make an actor for that.

02:19.640 --> 02:28.010
And just like our flame pillar, this is something that is more of a visual designer centric sort of

02:28.010 --> 02:28.850
mechanic.

02:28.850 --> 02:32.100
So we're going to make a blueprint for this.

02:32.100 --> 02:36.360
I'm going to put my fade actor here in the actor folder.

02:36.360 --> 02:42.450
We'll make a sub folder called Fade Actor, and we're going to make a base class for all of our fade

02:42.450 --> 02:48.120
actors and we'll have a new fade actor for each thing that we wish to have the capability of fading

02:48.120 --> 02:48.810
out.

02:48.840 --> 02:51.480
Now let's make that actor.

02:51.480 --> 02:54.300
It's going to be a new blueprint based on actor.

02:54.330 --> 02:58.770
It's going to be called BP, Underscore fade actor.

02:59.700 --> 03:03.720
And our fade actor is going to be simple.

03:03.720 --> 03:05.370
It's going to have a static mesh.

03:05.490 --> 03:07.560
So we're going to add a static mesh.

03:09.000 --> 03:13.680
And we'll just call this mesh and I'll give it a default mesh.

03:13.710 --> 03:16.590
I'm going to give it the perhaps beacon.

03:16.590 --> 03:20.690
And now we just need a way to fade out our actor.

03:20.700 --> 03:22.410
So how are we going to do that?

03:22.440 --> 03:25.680
Well, there are a number of ways we can approach this.

03:25.680 --> 03:30.690
I'd like to approach it from the material side, so I'm going to browse to the material.

03:30.690 --> 03:32.190
It's called M Beacon.

03:32.310 --> 03:37.050
It's actually using a material instance, this particular mesh.

03:37.050 --> 03:42.240
But I'm going to go into M Beacon, the material, not the material instance, but the material that

03:42.240 --> 03:44.910
this material instance is based on.

03:45.300 --> 03:55.440
So here we have a few nodes and we have a material, but I'd like to be able to add the ability to fade

03:55.440 --> 04:00.300
this thing out now in order to be able to fade out the material again.

04:00.300 --> 04:05.340
There are a number of ways to do it, but we want to be careful because there could potentially be a

04:05.340 --> 04:06.630
lot of these in the world.

04:06.630 --> 04:11.860
So changing our type of material could make things more expensive.

04:11.890 --> 04:16.950
One way that we can fade things out is by using opacity and opacity mask.

04:16.960 --> 04:22.660
Now, if we change our blend mode from opaque, we can change it to masked or translucent.

04:22.690 --> 04:30.190
Now masked is going to be a lot cheaper than translucent, so we would prefer masked, but I'd also

04:30.190 --> 04:34.600
prefer not to use a masked material unless we're actively blending out.

04:34.600 --> 04:41.380
So I'd like to have not only my M Beacon and its associated material instance, but I'd also like to

04:41.380 --> 04:46.240
have a fade version that uses masked as its blend mode.

04:46.240 --> 04:50.770
So I'm going to right click on M Beacon and duplicate it and we'll have a fade version.

04:50.770 --> 04:54.610
So this will be M Beacon underscore F for fade.

04:54.640 --> 05:01.360
You'll thank me later for not typing the full word fade because we're going to be doing this for a number

05:01.360 --> 05:02.770
of other materials.

05:03.010 --> 05:04.840
So this is the fade version.

05:04.990 --> 05:06.340
Let's open that.

05:06.340 --> 05:11.260
And here in the fade version we're going to change its blend mode from opaque to masked.

05:11.260 --> 05:15.700
And now we can see if we can figure out a way to fade out.

05:15.700 --> 05:22.300
Using an opacity mask, you see, opacity with a default value of one means that we can't really see

05:22.330 --> 05:23.710
through this material.

05:23.710 --> 05:28.150
And by the way, we can preview this on a given mesh.

05:28.150 --> 05:35.260
If we go to that mesh, for example, we can select some beacon and then come back here in the material

05:35.260 --> 05:40.690
and click on the bottom right icon so that we can preview this with a preview mesh.

05:40.720 --> 05:49.630
Now opacity has a value and we can hold the one key and left click to stick a value into opacity mask

05:49.630 --> 05:50.950
with a value of zero.

05:50.950 --> 05:54.700
Notice it's gone with a value of one notice.

05:54.730 --> 05:57.490
It's back with a value of 0.5.

05:57.490 --> 06:01.330
However, look, it's just the same as if it were one.

06:01.330 --> 06:05.290
And as soon as we get down below a certain threshold, it disappears.

06:05.290 --> 06:09.460
So it's almost like on or off, we can't really fade, right?

06:09.460 --> 06:11.470
So how do we get around that problem?

06:11.770 --> 06:17.260
Well, one way is a node called dither temporal AA.

06:17.620 --> 06:23.500
So this dither temporal AA will sort of dissolve a texture.

06:23.500 --> 06:29.650
If we plug in our value into it, then if we right click on the node and start previewing it, we'll

06:29.650 --> 06:33.970
see that this is what it looks like, kind of almost grainy.

06:34.000 --> 06:39.040
It's like a black and white texture with some sort of static in there.

06:39.040 --> 06:45.500
And if we change that value to say one, well, it's all white, zero is even darker.

06:45.500 --> 06:47.860
0.5 is somewhere in between.

06:47.860 --> 06:50.290
So we can see what this does for us.

06:50.500 --> 06:55.300
Now I'm going to stop previewing it and instead hook it up to my opacity mask.

06:55.300 --> 07:01.750
And now we can really see that you can kind of see through it At 0.5, at 0.1, you can almost not see

07:01.750 --> 07:02.380
it at all.

07:02.380 --> 07:04.620
And at one you can see it completely.

07:04.630 --> 07:10.840
Now, if this were a material parameter, then we could make an instance out of this and then we can

07:10.840 --> 07:12.250
change that dynamically.

07:12.250 --> 07:16.690
So I'm going to right click and convert this to a parameter and call this.

07:16.900 --> 07:20.470
We'll just call it fade and apply that.

07:20.470 --> 07:27.850
And now if we make a material instance of this material in Beacon F, we can right click create material

07:27.850 --> 07:28.480
instance.

07:28.480 --> 07:34.930
I usually prefix these with me for material instance, but in this case, because I want to create quite

07:34.930 --> 07:40.840
a few of these and don't want to have to rename a lot, I'm just going to leave it to Beacon F underscore

07:40.840 --> 07:41.350
inst.

07:41.380 --> 07:48.220
Now I'm going to open this and because I have this fade parameter, I can change it.

07:48.220 --> 07:53.320
I can bring it down to close to zero and see that it fades out in this nice way.

07:53.320 --> 07:54.580
Pretty cool.

07:54.730 --> 07:57.400
Now random is going to change how it fades.

07:57.400 --> 07:59.920
And if you want you can change this random value.

07:59.920 --> 08:04.690
Its default value is one and we can put a value between 0 and 1.

08:04.690 --> 08:07.940
So if I apply that and come back and play with this, you.

08:07.950 --> 08:10.500
You can see what it looks like with a different value.

08:10.500 --> 08:13.620
But I'm okay with leaving that at its default value of one.

08:13.620 --> 08:16.140
Just mentioning that that's a parameter there.

08:16.440 --> 08:22.140
So now I have this material instance that can fade out when it's at one or higher.

08:22.140 --> 08:27.930
It looks normal, but as we fade it out, this is what it looks like right now.

08:27.930 --> 08:32.160
By the way, this pillar, the beacon, has a glow parameter.

08:32.160 --> 08:39.180
And if you raise that, check that out, we get some glow on our rune.

08:39.180 --> 08:42.360
So just pointing that out, something kind of cool.

08:42.360 --> 08:49.770
But now that we have this fade parameter and we can fade this out, we need a way to do this on our

08:49.770 --> 08:50.190
fade.

08:50.190 --> 08:54.840
Actor Now one thing about meshes is they can have multiple materials.

08:54.840 --> 08:58.980
In fact, their materials exist in an array on the mesh.

08:59.070 --> 09:02.880
If we go into our fade actor, I don't need my flame pillar.

09:02.880 --> 09:04.020
I'm going to close that.

09:04.050 --> 09:11.190
My fade actor shows in the details panel the mesh and the materials and it says Element zero.

09:11.190 --> 09:15.660
Some meshes have more than one, so we need to take that into account.

09:15.660 --> 09:16.950
If we're going to make this fade.

09:16.950 --> 09:20.790
Actor We need to treat materials like arrays.

09:20.790 --> 09:28.170
In fact, if we go into the event graph and get our mesh out here and type get materials dragging off

09:28.170 --> 09:31.290
of it, we have get material and get materials.

09:31.290 --> 09:36.110
This returns an array of material interface object references.

09:36.120 --> 09:41.040
So keep in mind that a mesh can have more than one material.

09:41.130 --> 09:44.910
Our fade actor is going to take that into account.

09:45.090 --> 09:53.220
Now, the first thing I'd like to do is get those materials used by this particular mesh and store them

09:53.220 --> 10:00.330
in an array, because if we want to change a material instance dynamically, we have to create a dynamic

10:00.330 --> 10:07.680
material instance and assign that for our materials on the mesh and change those dynamic material parameters

10:07.680 --> 10:08.880
at runtime.

10:08.880 --> 10:15.240
And if I'm fading out and fading back in, when I fade back in, I'd like to replace the materials with

10:15.240 --> 10:16.890
what they were originally.

10:17.070 --> 10:20.280
So they're not always using the masked material.

10:20.280 --> 10:24.060
They can go back to their opaque or whatever they were using originally.

10:24.060 --> 10:31.530
So in the construction script, I'm going to get my mesh and get its materials with get materials.

10:32.930 --> 10:34.950
And store this array.

10:34.970 --> 10:39.860
I'm going to go ahead and drag off and promote this to a variable.

10:40.280 --> 10:43.940
And I'm going to call this original materials.

10:45.020 --> 10:47.360
Now, this is in the construction script.

10:48.100 --> 10:53.170
So every time we change something, we're just going to store all those materials.

10:53.440 --> 10:57.340
Now that I have these stored, I can loop through all of these materials.

10:57.340 --> 10:59.020
I can use a for each loop.

10:59.680 --> 11:06.860
And in this for each loop, what I'd like to do is make a dynamic material instance based on these.

11:06.880 --> 11:13.210
So what I can do is right click and use create dynamic material instance.

11:13.240 --> 11:16.090
This requires a material interface object.

11:16.090 --> 11:17.410
That's what we have.

11:17.680 --> 11:22.790
So for each iteration of the loop, we're creating a new dynamic material instance.

11:22.810 --> 11:28.300
We can leave creation flags at none and we don't need to give it an optional name.

11:28.600 --> 11:35.680
Now, each time we do this, I'm going to want to store it in a dynamic material instance array.

11:35.980 --> 11:43.960
So I'm going to make a new variable and call this dynamic material instances.

11:44.230 --> 11:49.310
And this can be of type material, instance, dynamic.

11:49.550 --> 11:51.440
So we're going to search for that.

11:51.740 --> 11:57.080
It'll be an object reference, but we're going to change this to array right here in the details Panel.

11:57.080 --> 12:02.810
Next to variable type, we're going to select array and we're going to take that array.

12:03.320 --> 12:05.420
And we're going to call Add unique on it.

12:06.680 --> 12:11.750
To add our new material instance dynamic to it.

12:11.960 --> 12:18.740
Now this is done in the construction script, so we don't want to fill this up unless we're going to

12:18.740 --> 12:20.120
use those materials.

12:20.120 --> 12:25.640
So what we can do first thing is clear this array, because we don't know how many times this is going

12:25.640 --> 12:26.590
to be called.

12:26.600 --> 12:31.400
So we're going to take dynamic material instances and call clear.

12:32.480 --> 12:33.200
That way.

12:33.200 --> 12:37.910
Before we go and fill it up, we make sure we clear out whatever we had before.

12:37.940 --> 12:45.680
So now that we'll have our dynamic material instances created based on our original materials, we can

12:45.680 --> 12:49.910
now create the capability to change those material parameters.

12:49.970 --> 12:51.140
So here's what I'm going to do.

12:51.170 --> 12:52.520
I'm going to go into the event graph.

12:52.520 --> 12:58.520
We're going to use event begin play, and I want to loop over my dynamic material instances.

12:58.520 --> 13:07.910
So I'm going to use a for each loop and for each of these I'm going to now set my meshes materials to

13:07.910 --> 13:09.860
these dynamic material instances.

13:09.860 --> 13:16.190
So I'm going to get my mesh and I'm going to call set material and set material takes an element index.

13:16.190 --> 13:21.860
So as we're looping through this array, we're going to use the array index as the element index.

13:21.860 --> 13:23.630
So we're going to hook that up.

13:23.630 --> 13:27.650
And the array element is a material instance dynamic.

13:27.650 --> 13:34.500
We can hook that in and then our mesh will now be using that dynamic material instance.

13:34.740 --> 13:38.610
Now this action here could be its own function.

13:38.610 --> 13:44.670
Basically what we're doing here is we're setting the materials to the dynamic instance.

13:44.670 --> 13:52.110
So I'm going to right click on this and collapse it to a function and call this set materials to dynamic

13:52.140 --> 13:53.340
instances.

13:54.910 --> 14:02.550
Now, as soon as we've done that, we can now set the parameters on these dynamic material instances

14:02.560 --> 14:06.670
so we can take that array of dynamic material instances.

14:07.790 --> 14:10.880
We can loop over it with a for each loop.

14:11.410 --> 14:13.180
And we can set parameters on it.

14:13.180 --> 14:19.720
For example, we can take the array element and we can call set scalar parameter value.

14:21.230 --> 14:23.900
Now this requires the name of the parameter.

14:23.900 --> 14:29.420
And if we go back to our instance, it's called fade, the one I'd like to change so we can change this

14:29.420 --> 14:35.980
to fade and I can set its value to say 0.5 and hook that in.

14:35.990 --> 14:43.280
So now if we have a fade actor on begin play, we should see it faded to about half way.

14:43.280 --> 14:49.640
So I'm going to save all I'm going to browse to my fade actor and drag one into the world.

14:51.420 --> 14:52.890
I'll put one right here.

14:53.040 --> 14:54.210
Press play.

14:55.710 --> 15:02.400
Now I don't see anything, so I'm just going to make sure my dynamic material instances array is not

15:02.400 --> 15:03.300
empty.

15:04.260 --> 15:06.030
So on begin play.

15:06.630 --> 15:08.490
I'm going to get its length.

15:08.970 --> 15:10.110
It should be one.

15:10.870 --> 15:12.310
But I'm going to print that out.

15:14.990 --> 15:17.510
So printing out the length of this array.

15:25.090 --> 15:25.450
Okay.

15:25.450 --> 15:27.730
So it does contain one element.

15:27.730 --> 15:28.870
It's not empty.

15:32.500 --> 15:33.400
Let's see what it looks like.

15:33.400 --> 15:37.090
At 0.5, it should look like this half faded out, basically.

15:38.770 --> 15:41.580
But of course we're not using Beacon.

15:41.910 --> 15:45.940
Instead, we're using the other material instance that we started with.

15:45.970 --> 15:52.390
So really, we need an array of material instances that we can create our dynamic material instances

15:52.390 --> 15:58.060
from here in the construction script, as we can't really use the meshes materials unless we want the

15:58.060 --> 16:01.240
mesh to have those materials from the start.

16:01.240 --> 16:07.210
And our fade versions are based on a material using masked mode.

16:07.210 --> 16:11.650
And I don't necessarily want to use masked except for when we're fading in and out.

16:11.650 --> 16:19.780
So fade actors should have another array in it, and this will be our material instances and more specifically,

16:19.780 --> 16:22.000
our fade material instances.

16:22.000 --> 16:25.180
And this can be of type material instance.

16:25.850 --> 16:27.830
So we're going to change it to that type.

16:27.830 --> 16:33.770
It's an array and this is something we'll have to set and we'll have to make sure to set it in the correct

16:33.770 --> 16:34.520
order.

16:34.580 --> 16:43.700
So if I compile in my fade material instances, I can click plus to add and I can add my m beacon inside

16:43.730 --> 16:50.810
my fade version of the material instance, I can set that there and in the construction script, rather

16:50.810 --> 16:57.050
than looping over our regular materials, we do want to store those in our original materials, but

16:57.050 --> 17:03.030
our for each loop should loop over our fade material instances instead.

17:03.050 --> 17:08.600
Now, if we hook that into our for loop, we're making a dynamic material instance from each of our

17:08.600 --> 17:13.180
fade material instances, and that's going to give us the result we want.

17:13.190 --> 17:19.730
So if I go in, save all press play now I see that it's faded half out.

17:20.650 --> 17:21.940
So that looks pretty cool.

17:22.770 --> 17:23.040
Okay.

17:23.040 --> 17:30.420
So now that we have the ability to set the material instance parameters dynamically, we don't want

17:30.420 --> 17:31.710
to just do it in begin play.

17:31.710 --> 17:34.750
We want to be able to change it at runtime.

17:34.770 --> 17:36.590
Now I don't want to use Tick.

17:36.600 --> 17:39.270
In fact, we don't even need to start with tick enabled.

17:39.270 --> 17:40.620
I'm going to uncheck that.

17:40.650 --> 17:44.010
What I'd like to use instead is another timeline.

17:44.770 --> 17:50.560
So I'm going to get these unused nodes out of the way and I'm going to make a timeline for fading.

17:50.560 --> 17:56.290
So I'm going to right click, I'm going to create a new timeline, and this will be called our fade

17:56.320 --> 17:57.370
timeline.

17:58.680 --> 18:02.120
And the fade timeline is going to have one track.

18:02.130 --> 18:04.830
It's going to be called Fade.

18:06.210 --> 18:08.730
And we'll have two keys on it.

18:08.820 --> 18:11.910
Now, how long we want to fade is up to us.

18:11.940 --> 18:14.550
I'm going to use perhaps half a second.

18:14.580 --> 18:16.710
Maybe one second while testing.

18:16.710 --> 18:19.170
So the length will be one second long.

18:19.200 --> 18:22.860
The first key will be at zero and one.

18:23.340 --> 18:26.950
The second key will be at one and zero.

18:26.970 --> 18:33.480
So this is a fade out timeline and we can highlight both of these, make it an auto curve so it's smooth.

18:33.570 --> 18:37.590
And now we have this one second curve that fades out.

18:38.240 --> 18:40.200
So back to the event graph.

18:40.220 --> 18:43.850
If we play this timeline, I'm going to click play from Start.

18:43.850 --> 18:50.750
And by the way, if I check use last keyframe, this will work nicely in reverse as well as we can reverse

18:50.750 --> 18:52.700
from the last keyframe we were at.

18:52.850 --> 18:58.970
But here in update, I'd like to set the parameter values to the fade on the curve.

18:59.000 --> 19:02.930
Now this set materials to dynamic instances.

19:02.930 --> 19:04.580
This doesn't have to be done.

19:04.580 --> 19:05.780
Every update.

19:05.780 --> 19:08.210
This can be done before we start the curve.

19:08.450 --> 19:14.300
So I'm going to put it right here before play from start and on the update, we're going to loop through

19:14.300 --> 19:15.350
each of our materials.

19:15.350 --> 19:21.890
There's only one in this actor, but we're going to use the fade amount and set the scalar parameter

19:21.890 --> 19:22.600
value.

19:22.610 --> 19:27.230
So we should see our pillar fade out over the course of one second.

19:27.380 --> 19:29.240
And there it goes and it's gone.

19:29.270 --> 19:30.320
Pretty cool.

19:30.680 --> 19:33.680
So I'd like to make this a custom event.

19:33.680 --> 19:39.270
So I'm going to right click custom event and call this Fade Out.

19:39.510 --> 19:49.410
So now we have a fade out event that we can call to fade out, and I'd like a fade in event.

19:49.410 --> 19:56.100
So I'm going to make another custom event called Fade In, and this one can play in reverse.

19:56.950 --> 20:01.530
And in fact, our fade out doesn't have to play from start.

20:01.540 --> 20:07.690
If we play and use the last keyframe, then we can fade out and in and it doesn't matter where we are

20:07.690 --> 20:13.120
on the curve, we'll resume where we last were and go forward or backward, depending on if we're fading

20:13.120 --> 20:14.470
in or out.

20:15.000 --> 20:20.280
Now, if we're fading back in, we've already set the materials to use the dynamic instances.

20:20.280 --> 20:26.430
But really, I'd like to set those materials back to their original materials because those might not

20:26.430 --> 20:29.450
be masked, they might be opaque.

20:29.460 --> 20:37.800
So what I'll do is when our curve is finished, if our fade amount is back to one, in other words,

20:37.800 --> 20:41.810
we'll do a greater than or equal because I never do equals with floats.

20:41.820 --> 20:45.900
If it's greater than or equal to one, we'll have a branch here.

20:46.880 --> 20:48.680
And on finished.

20:48.710 --> 20:51.340
This means we've just finished fading back in.

20:51.350 --> 20:57.710
So in that case I'd like to take my original materials and do a for each over them.

20:58.460 --> 20:59.960
And for each of them.

21:00.630 --> 21:04.620
I'm going to take my mesh and I'm going to set its material.

21:04.620 --> 21:06.480
So call set material.

21:08.320 --> 21:10.390
And we'll set the materials all back.

21:10.390 --> 21:14.730
So we're going to use the array element and the array index in the for loop.

21:14.740 --> 21:19.840
So this is basically resetting all the materials back to their defaults.

21:19.840 --> 21:21.540
So this can be its own function.

21:21.550 --> 21:25.600
I'm going to collapse it and say reset materials.

21:26.050 --> 21:28.090
That's good reset materials.

21:28.630 --> 21:38.170
Okay, so now we have a fade out and a fade in so we can test this out by calling fade out and begin

21:38.170 --> 21:44.080
play and then perhaps doing a delay by a second.

21:44.110 --> 21:46.540
I think our timeline is one second long.

21:46.540 --> 21:47.410
Yes.

21:47.470 --> 21:49.150
So we'll do a second delay.

21:49.150 --> 21:53.560
And as soon as that fade out has completed, we'll do a fade in.

21:54.180 --> 21:56.940
And we'll see that mesh come back.

21:56.940 --> 22:01.670
And by the time that finishes, we should reset the materials to their originals.

22:04.740 --> 22:07.640
All right, let's save all and let's see this fade out.

22:07.650 --> 22:08.400
There it goes.

22:08.400 --> 22:09.660
And it's back.

22:09.720 --> 22:14.130
So we now have the ability to fade out and fade in.

22:14.520 --> 22:15.870
And that's great.

22:16.620 --> 22:19.560
Now I'd like to take collision into account.

22:19.590 --> 22:26.100
You see, if something's faded out, I want to be able to move my mouse and say there's an enemy back

22:26.100 --> 22:26.730
there.

22:26.850 --> 22:28.950
I'd like to hover over that enemy.

22:28.950 --> 22:34.620
And if this wall is faded out, I don't want it to block my cursor Trace.

22:34.620 --> 22:36.740
I want to still be able to trace through it.

22:36.750 --> 22:46.350
So while faded out, I want this mesh in my fade actor to ignore visibility and when I fade back in,

22:46.350 --> 22:48.150
I want to block visibility.

22:48.330 --> 22:56.220
So what we'll do here is in the finished after we've checked to see whether we should reset our materials.

22:56.220 --> 23:02.820
If we're fading back in, I'm going to take my mesh and I'm going to call set collision response to

23:02.820 --> 23:03.630
channel.

23:04.360 --> 23:10.090
Choosing visibility and I'm going to set it to block We're going to block the visibility channel.

23:10.120 --> 23:18.100
However, in our case here, we'll have another branch in our false case and we're going to check the

23:18.100 --> 23:21.340
fade amount to see if it's zero.

23:21.340 --> 23:23.590
So less than or equal to zero.

23:24.750 --> 23:32.460
And that means we've just faded all the way out, in which case we're going to set our mesh to ignore

23:32.460 --> 23:33.450
visibility.

23:33.660 --> 23:35.970
So visibility ignore.

23:36.210 --> 23:39.750
And so this is all stuff we can do on finished.

23:39.750 --> 23:45.600
So we're going to highlight all of these collapse to function and call this fade finished.

23:47.970 --> 23:51.260
Actually, I don't need two inputs, do I?

23:51.270 --> 23:52.260
These are both the same.

23:52.260 --> 24:00.780
So what I'm going to do is control Z that and to fix that, what we can do is we can have a root node

24:00.780 --> 24:03.690
and have this come out of it like that.

24:05.400 --> 24:10.890
And then highlight these again including the reroute node and collapse these to a function.

24:10.890 --> 24:14.910
And now it has a single input and this will be fade finished.

24:17.290 --> 24:21.760
So now our blueprint is looking under control and of course, retesting.

24:21.760 --> 24:22.600
It fades out.

24:22.600 --> 24:23.440
It fades in.

24:23.470 --> 24:24.340
Perfect.

24:24.430 --> 24:31.050
Now that we have a fade actor, all we need to do is decide when to fade it out and fade it back in.

24:31.060 --> 24:34.270
Because Beginplay is not the place to do it, right?

24:34.300 --> 24:38.920
We want to do it as our character goes behind it, right?

24:38.920 --> 24:43.780
So if it's obstructing our view from the camera, then we want to fade it out.

24:43.780 --> 24:47.230
So that is something we'll handle in the next video.

24:47.260 --> 24:48.500
Excellent job.

24:48.520 --> 24:49.630
I'll see you soon.
