 Hello and welcome back to GameDevAcademy. I'm Shane and in today's video lesson I'm going to show you how you can get a waving flag just like this up and running in Unreal Engine in no time at all So first thing I need to do is stop this running and get out a full screen And you see I've got a flag in there. It's all set up What I'm gonna do is just delete this so I can take you through the process of getting it set up So you can see I've got all bits and bobs in here that I'm just gonna delete Get rid of these And I've also got a wind going on that I also need to delete. Okay, that's perfect Now what we need to do is get this set up and I want to show you exactly how it works first of all So this is the model that I created for this exercise. You can see it's pretty straightforward We just have a flagpole and a flag now What's important about this flag is you can see that I've got it quite heavily subdivided And I wanted this to look more like a silky satiny kind of flag So I found that in order to do that I needed to divide it quite high You see the squares on this are quite small And another thing that I learned is that in order to get this to come in as one mesh I've had to do some parenting So the flag is a child of the pole and the pole is the parent of the flag and in order to do that if I just Unparent it so we go to edit Unparent to parent that all I need to do is select the flag first Shift select the pole and then just go to edit parent and And then it's just a case of exporting that as an fbx like you would anything else if you're moving it into a real engine So let's get this important into a real engine then we're going to go to a real engine And I'm just going to import it to the content folder I would sort it if I was doing this properly, but it's just an exercise into it. So let's go to import Find the mesh so I won't flag there it is next to my marriage certificate and What is important to get this to work is that we tell it that it's a skeletal mess that's all you need to change on here and then you can click on import it will tell you that there's no bind post there Isn't a bind post because there's not actually any bones in this and there's also no smoothing group again That's fine because I didn't put any in there So we can close that and then what I'll do before I start getting all the wind and stuff set up is I need to Just set up the materials so we'll do the pole first and I've got this set up just so that it comes through And then what we're going to do is just kind of set it to like a metallic steel So we're going to go for quite a dark gray. I might just add a blue tint to it Just slight A little bit darker something like that and then we're going to add a constant To handle the metallic and we're going to set that to one and One more constant which is going to go in the roughness and I want to set this to about 0.5 Actually, I think I'll go a little bit lower. Let's go 0.35 35% rough Yep, that'll do it and then we can save that one and close it down Lovely and then we need to do Something similar with the flag but in order to do that. I also need to bring in some textures So I'm just going to go to import to gain. I've got flag and Ukraine flag Obviously, I'm doing the Ukraine flag There's some awful stuff going on there at the moment And whilst I don't have a flag pole to share my solidarity in real life I can absolutely do it on YouTube content. So there we go. I'm just going to now save everything awesome, and then we go into our flag material I Can delete this and we're going to bring in some texture samples This one is going to be the color and we'll put that into RGB This one's going to be the normal and we'll put that into the normal This one just needs to be tiled. So I'm going to get a texture coordinate node Like so plug that into UV's and we're going to tile that three times on each axis And this is just to make it look a bit more like fabric not that you can really tell but I know it's there And I want it to look good. So we've got that and then finally I want a constant for the roughness Because I want this to look kind of like a satiny flag as I said So we're going to go for something like 0.4 and I can always come back and change that later if I don't like the effect Yeah, we'll give that a go and then save it Okay, with that done what I'm now going to do is just drag the flag in like that and then rotate it around so that I can actually see it and As I rotate this around you can see that I've forgotten to do something so back into the flag material and We just need to say that this is a two-sided material should have done that in the first place I should know better than that there we go and Now we can actually see the flag success Okay, so now that we've got that in there The next thing to do is to actually get this to behave as cloth Which is what we're doing to get the flag to do what we want it to do with simulating cloth So let's go into the flag asset here. So it's the pinky purple you want double click on that And then we'll just rotate around so we can actually see the flag We'll do it that way just to match how we've got it in the city fact now Let's do it that way because this is actually the front and then we need to activate the clothing Section so this is this window here, but if it's closed which it might be by default So I'll just close mine you can go to window clothing That will open it up and then you need to select it and to do that make sure you click on section selection first Otherwise it won't work. So make sure that is activated Click on the flag then you can right click on it and we're going to do create clothing data from section And then just go down to create that's fine Then we need to right click on the flag again And we're going to go to apply clothing data this time and then just there's only one available So we'll click on that and then that now kind of sets it up and we want to be able to paint on it So that's this activate cloth paint up here We'll give that a little cheeky click and it won't let us paint straight away We need to say that we're painting on this clothing data And then we get this brush that we can work with so by default the paint value here is set to 100 Which I actually like that works out pretty well So we're going to leave that as it is and the only thing I'm likely to change is the brush size But first let's just get in a little bit close So you can see that these are kind of all pink and that means at the moment if we did anything in fact if we deactivate it This is now Simulating the cloth you can see it's still not doing anything So we need to paint those pink bits away and if I just paint kind of like half down here And then deactivate it You can see that that's now doing something So we'll go back in and we'll sort of paint the rest and I think it's going to make me paint around the backside of it as Well, but we'll see so we're going to go kind of up to the edge here And at that stage, let's just go down to the bottom. I'm going to need a smaller brush So let's just bring this radius down so I can be a bit more precise And I'm probably also going to need to just get in a little bit closer Because what I want to do is just paint up kind of to the one Final row of vertices at the side. I don't necessarily have to be super Accurate with this because it is fairly forgiving as long as some of it's there But what I want you to do that and then I want it to look like it's attached in like three places So I'm just going to do that there Let's just see if I can actually see what I'm doing and Do that there and then I'm just going to leave a little strip in the middle as well Hopefully you can see that so a bit of pink up there a bit of pink there and a bit of pink at the bottom Now we'll deactivate that And you can see it's doing this here Which is mighty frustrating So what I'm going to do is just go around the back and Just try and paint it from the other side and see if that will alleviate the problem I'm having so we'll make the brush a bit bigger again And we're just going to paint away here at this side and then we'll deactivate Still not behaving itself Okay, if it does this to me did this to me last time I try this I can also try up in the paint value to something higher. We'll go for 500 and Then we'll paint this side away with it again And then we'll deactivate Much better. So now you can see I just needed a bigger value there, but it's working. It's behaving itself So that at this stage is actually set up to behave as a flag so we can save that and I'll show you this working in the level So if we now go to play and I go to instead of just playing the game I go to simulate that allow me to still make some changes in the level as I'm working with it So just wait for this to catch up There we go, so that simulation is now happening so I can now click on this mesh and with my rotate tool on If I rotate it you can see I can actually wave the flag the simulations happening all the time So that's pretty good So let's just hit escape to come out of there and that'll put it back But if you want it to go like it was at the beginning of the video then you probably want to have on Some wind So let's get some wind. We'll go to create up here We're gonna go into all classes and just scroll right down because I know it's near the bottom somewhere and then we're looking for Wind where is it? Wind directional source. There it is. So we give that a click and If I just move this down a little bit this blue arrow here controls which direction the wind is blowing And that's actually perfect for all you want because it's blowing that don't know I'm that way blowing that way so Now that that's happening we can just select the wind direction We just need to make it a bit stronger and I've tested this already I know that for this level and this flag a value of about 13 is good And that's all we need to change if we now go to simulate again There we go and that is now Blowing in the wind it is beautiful One other thing that you might want to do if you just experimenting with it is if you search for your wind here While we're in the simulation mode we can make changes So if I decide that I want the wind to be not quite as strong, let's go for eight And you can see that that wind has now dropped and we're getting a slightly different result out of the flag But as I say I quite like a value of 13. So I'll add a bit more wind to it. There we go And so that brings us to the end of this video Obviously, you might see that there is a little bit of a hidden message in this video somewhere And what I will be doing with the proceeds of this video and all the ad revenue I'm going to donate to a charity. I don't know which one but a charity supporting Ukraine Whichever one I choose I will put in the link in the video description I'll also leave a link if you want to donate to support the people in Ukraine as they're going through a really difficult time right now Anything we can do to help them. I'm sure it's it's not much but Hopefully everything will come together to make a difference in some small way I would also like to say thank you to my patrons who keep supporting the channel Extremely extremely helpful. It helps me to keep doing what I'm doing It gives me time during the week to be able to work on exercises And I feel incredibly lucky that there are people that allow me to do this So thank you so much. If you want to become a patron link is in the description below Otherwise, thanks for watching and I will see you in the next class