Unreal Engine AI Path Finding Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to the tutorial in this tutorial we will use the integrated AI pathfinding system to find the best way to our destination and make it visible for us like this so let's go the first thing that we need is the AI itself so right click blueprint class character and let's call this AI here open this up this gets some sphere component just to make it visible let's go to the event graph we can delete everything except for the begin play event and also we need the variable called Target this will be in Target Point object preference and be sure that it's public first we need a reference to self we take out the target Point as well and we need the AI move to function self is the pawn and the target actor is the target compound safeties now we go to the character movement and we will change the max acceleration to 900 0. you can copy this for the max workspeed as well we have to change the walkable floor angle to 90 the ground friction to 500 and we can uncheck this one here and check the ignore base rotation 2 true that's it compound save this let's place our AI into the world let's say this corner here as well we search for the Target point and place it into the world here open up the details of our AI here and we can select our Target point the next thing that we need is the enough mesh bounce volume let's place it into the world go to the top view because we make this over the whole map here so the volume has to be the same size of the map and when you press P you can see now it is already whole map and clarify the navigation here so when we now hit play the AI move to its Target and it does it so fast that you can't even see it the next step is to make it visible which part the AI actually took for this we will use these Street Parts here I already prepared one so we have for example this straight Street part here just a static mesh and also add up these box Collision here this is just enough trigger so when the AI moved to the street part it recognized this one here also we have this plane component when I go to the details and make this visible you can see it's just in plan with a green texture so let's make this unvisible so we can change this later as well we have this nav block this is also a box Collision on each side of the road so that the AI can't move to the sidewalk only on the streets so let's select the enough trigger here the Box Collision go down here on begin overlap so we just want to cast to our AI sphere here we take out the plan here and want to set the visibility to true and that's it so we make it visible also I have different street parts so let's copy this functionality we have also this Crossroad same system so we have enough trigger as well and we have four enough blocks solid the AI can't move on this sidewalks here and we just copy and paste the functionality inside here as well for the T cross here like this one to understand how the AI calculates this past let's go to the project settings and type in cost you have the draw polygon costs and when we now go to the level every part of the level has its own cost so the AI will calculate the less amount of costs it took to the destination so that the AI don't go straight to the destination we have to make obstacles for this let's open up our road again we have our nav block collisions here we have our navigation tab where we can select the area class and let's select the obstacle and check the dynamic obstacle to true also we will do this for the other parts of the streets like this one as well here like this one but we now go back to the level you can see these red areas here where it shows that the cost is much higher than the other parts so the AI will avoid these parts here so every time I move this target point the AI will find his best way to get to the destination like this of course you can always optimize the AI by modifying the character movement for example the max step height you can put 210 or the ground friction to 1000 also you should remove these three objects that you don't get any Collision problems I hope you enjoyed the tutorial if any questions please let me know and yeah goodbye
Info
Channel: Seredias
Views: 14,572
Rating: undefined out of 5
Keywords:
Id: fYSEshgc8WU
Channel Id: undefined
Length: 5min 21sec (321 seconds)
Published: Sun Feb 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.