Unreal Engine World Map Navigation Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to the tutorial in this tutorial I want to show you how you can create these world map navigation which draws the fastest way to a destination automatically so let's go first of all this system is based on the AI navigation tutorial link is in description so what we already have is this tracking here where the AI can go and where it nut can go so what we have to do is we prepare the AI so we create a new one so right click equipment class and we choose Pawn let's call this AI Navi open this up this gets some capture Collision here just for testing and as well it gets some floating Pawn movement we go to the details select this and the recommend the speed of 40 000 you can play around with it maybe it's too high then you have to lower it you can see the results later so let's open up the event graph we can delete everything inside here except for the begin play event we create a new variable called Target Target will be in Target Point object reference just for example you can choose whatever you want and make this public then we pull the target out here get the location so reactor location here and then we just say a I move to of course we need the reference to self here this will be the pawn and the destination is the actor location here and on success we just destroy the actor let's place a little dealer inside here just for testing that we can see the results later of three seconds we can compound save this and that's it here let's go back to the level and the next part is we want to have a game instance where we can save the positions when the AI crosses these Street Parts here so right click group and class and search for game instance this one here let's call this my instance open this up just gets one variable that's called current Navi current Navi is an array of 2D vector like this compound safeties we are also done here we can close this very important you go to the project settings under maps and modes and be sure you selected the right instance on the game instance class let's go to the road parts from the last tutorial again links in description we have these nav blocks here where the AI can't pass and we have this enough trigger which dri will be passing so we go to the details on begin overlap of course we will cast to our AI that we created then we get the game instance of course we cast to our instance that we created like this one here we get the current Navi Saudi array and then we just want to add something to the array like this one here we say right clicks bit structure pin we take out enough trigger here get the world location again right click split structure pin we go from the X and say float defeated by another float copy and paste this down here for the Epsilon and both of these are 30. I will explain later why it is 30. so we connect it with the X and the Epsilon and we are done here as well of course we copied this for other Street parts so copy paste this is for the T cross here as you can see same concept we have the blocks and enough trigger here great so we know save the positions of every street part that the AI is crossing next up we want to create the map itself so right click materials and textures render Target and let's call this map underscore view open this up and let's choose a size of 2048 multiplied by 2048 just for example you can choose whatever you want let's save and close this next up we need the camera so right click blueprint loss actor and let's call this camera underscore map open this up as well this gets of course unseen capture components 2D let's go to the details on the projection we choose or the graphic and put the author with to 25 000. so the reason for this is when we go back to our level here I created already a landscape let's go to the details here the resolution of the landscape is 249 multiplied by 249 so you can round this up to 250 so that's very important that you check this value here let's go back to the camera map and this is why I choose the other width of 25 000. let's go down here to the scene capture and we can choose our map view here and let's say the capture source is the scene dipped in a then we go to the construction script we need a new variable and this will be the land scape of course the landscape is um landscape object reference and we make this public here pull this out we get the location so the actual location of this one right clicks with structure pin and then we will just want to set the actor location we can keep this to self because we want to set the camera location right clicks with structure pin and then we go from the X and say float plus float and put this to 12 500 so the exact half of the map and as well for the Epsilon so it will be exactly in the middle of the landscape and the Z will be 1 000 so it is much above the landscape so that you can capture the whole map let's open up the details again and set the rotation of the Epsilon to -90 and DZ as well and we are done here so compile and save this we can pull out the camera now and it automatically plays it in the middle of the landscape let's go to the details and choose our landscape right here and we now take a look on the texture here it already created a live map of our landscape here great next we need to widget where we can see the maps or right click use interface which should let's call this map open this up we can delete the canvas and get an image here like this one and the images of course all are map view like this one the image size is 2500 multiplied by 2500 you remember the size of our landscape you can put the view to desired that you can view the map how it really is compound safeters let's go to the graph we need one function inside here to draw the lines for the path so we go to the functions overwrite and say on paint pull this out here and unplug this we get the game instance we cast to our instance that we created we get the current Navi so the array and then we go from the context and say draw lines connect the points with our current Navi like this one you can choose which color the line should have let's say this is red the anti-allies is checked the truth it's fine and the thickness you can put to for example 20 you can play without this and connect with the return value and that's it compile and save this the last step is to create the heart so we can close this run again right click use interface widget let's call this Hut open this up and we want to do is we go to user created and pull out our map here and I would recommend the size in this case of 833 and 833 the reason for this is when you multiply 833 by three times you get 2499 so pretty much the size of our map here that's the reason why we multiplied everything by 30 earlier on the roads part so let's place this wherever you want like this one here compile and save this and we are done here as well let's go to our character in my case it's still struck here let's open this up and the only thing that we need is we haven't begin play event where we just want to create and widget of course we choose our Hut here and add this to an variable of course we will call this map then let's choose and key just for example the m key here and we pull out the map then we choose some flip flop here go from the map and we'd want to add it to the viewport on a and we want to remove it from the parent on B like this one great let's see if this works let's go back to our level here place the AI next to our player start like this one then we go to place actors choose our Target Point here go to the end of the map like this one here place it wherever you want then we go to our AI Navi go to the details and choose our Target right here and then we just hit play open up the map with M and after three seconds he draws the perfect path to our destination I hope you enjoyed the tutorial if you have any questions please let me know and yeah goodbye
Info
Channel: Seredias
Views: 2,659
Rating: undefined out of 5
Keywords:
Id: VaLsTDpCf8E
Channel Id: undefined
Length: 10min 57sec (657 seconds)
Published: Sat Apr 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.