Dynamic NavMesh With Nav Modifiers Only; UNREAL ENGINE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys in this video we're going to use the dynamic nav mesh settings so that it'll update as our objects move across the screen so let's go ahead and get started with that okay so let's go ahead and take a look at this from scratch the first thing we'll do is we'll start the game and we'll show the nav mesh and what we're going to see is that by default the nav mesh is set to static so that means that the original footprint of the objects are baked into the nav mesh at the time the level is compiled and then the nav mesh is not going to update to accommodate the movements of the objects so that's the first thing we want to try and fix so we're going to exit out of the game and we're going to go to edit project settings and then we'll search for runtime and under the navigation section we'll see runtime generation and again we see that by default it's set to static so we want to select from one of these two Dynamic options we have Dynamic modifiers only and then we have fully dynamic and this option also includes everything that's in here as well so the difference between the two is that this one is generally considered a little more resource intensive so we'll take a look at this one in a little bit but let's focus on this one first Dynamic modifiers only so with this option the overall nav mesh basically stays static but anywhere you put a nav modifier that particular area will be considered Dynamic and that area can update with moving objects so let's go ahead and take a look at that okay so let's turn the nav mesh back on and the first thing we're going to see is that nothing happened and the reason why is because this option requires that you attach nav modifiers to the things that you want to update the nav mesh with so let's go ahead and take a look at how to do that we'll exit out of the game we'll select one of our objects that's going to be moving and we're going to add a nav modifier to it and for now we'll just leave it on area class null and now let's go back into the game and go ahead and turn the nav mesh on and so now we see a couple of things first off we see that the nav mesh is turning red so this is not a glitch this means that the nav mesh is updating because these tiles are being affected by the nav modifiers that we just placed on the moving object and we can see over here for this moving object that since we didn't place any nav modifiers on it nothing is updating but if we come back to the object that we did work with even though it is updating the nav mesh when the object moves it's also keeping the original footprint because again that was baked in at the time the level was created so the first thing we want to do is try to get that out of there so let's go ahead and exit the game and we'll go back to our moving object and what we want to do is we want to select all of the geometry on the object that's going to be affecting the nav mesh and we'll just type in nav and we're under Collision where it says can never affect navigation we'll just uncheck that and we'll compile and Save and then just really quick for demonstration purposes I'm going to select my nav modifier and under area class I'm going to set it to none and this is just so that we can see what went on here so back on the level editor if we look at the object because the geometry is no longer affecting the nav mesh it's not baking its footprint into the nav mesh anymore so now that we've seen that we can turn the area class back to null and we'll compile and save and so again it's cutting into the nav mesh but that's the nav modifier that's doing that that's not the footprint of the object itself and the nav modifiers are going to dynamically move along with the object and update the nav mesh so we'll see what that looks like so we'll turn on the nav mesh and again the footprint is gone because it was never baked in and the nav modifiers which are attached to the object that's what's affecting the nav mesh okay so in addition to the moving objects another time that you would want to use these Dynamic nav mods is whenever you're spawning items in during gameplay so an example of that we'll take a look at this blueprint here let's say this is a build piece for a settlement building project so we would build we would pull in a nav modifier and we would set the area class to null and let's go ahead and take a look at that in game so let's say we want to build our settlement and we lay down this build piece we want the nav mesh to update to show that this area is now occupied and then as you're building and removing items we want the nav mesh to update again so that you're able to walk through so we want the nav mesh to properly update as you add and remove building pieces and that'll keep the nav mesh nice and clean for your settlers okay let's go ahead and look at another example okay so for this next example we're going to be using a new area class so far we've been using area null now we're going to switch over to area obstacle and we're going to see that using this blueprint here which is a fire effect so let's go ahead and start the game okay so let's go ahead and pull our character over here where we have a little more room and let's say if you're casting fire spells or throwing grenades or Molotov cocktails it starts a fire effect that kind of lasts on the floor for a little bit after the initial explosion and then as more characters come it could be a follower or an enemy they kind of just walk right through the fire and that can kind of break the immersion of the game a little bit so let's see how we can fix that okay let's go ahead and open up the blueprint of the fire effect and before we start we do want to look at something when we first drag in our nav modifier if we come over here to where it says fail safe extent it's telling you that box extent used only when owning actor doesn't have Collision component so in this case I do have a collision component because uh later on I'm going to put a on actor overlap so that anyone who touches the fire takes damage but the problem it's going to cause right now is that the Collision box also has a navigation area class and it has this checkbox Dynamic obstacle so as long as you have these things filled out then the size of the Collision box and the area class is going to override whatever size and area class you use on the nav modifier so go ahead and go to your Collision box if you have one or any other Collision component and set the area class to none and uncheck the dynamic obstacle box and then compile and Save and now you can use your nav modifier and it won't get overridden by any of the Collision boxes so with the nav modifier we're going to set our area class we've been using null but now I want to set it to obstacle and then we could set the size but for now I'll just leave them by at the defaults and we'll compile and Save and then we'll go back into the game and we'll see what it looks like okay so let's turn the nav mesh back on and we'll come back over here and we'll drop the fire down again and so we can see that it has the nav obstacle color code over it that's the dark red box and so that means that now when the bad guy comes to get us instead of running right through the fire he should try to run around the fire okay and then as the fire goes out now he's able to come straight at us again unimpeded okay so using the nav area classes like obstacle or even creating your own custom area classes and combining them with query filters which allows you to distinguish between different types of characters who will be affected by those area classes like your player character friendly followers and you know hostile enemies those can be a really good way to control where the characters go on the map to again kind of keep the immersion intact because sometimes let's say if you have a follower and you're going through a dungeon or something and you're trying to disarm a trap like maybe some of these here or something and then your follower just kind of like walks right through them and sets the Trap off right when you're trying to disarm them that can kind of be frustrating and like kind of really break the immersion of the game so if you need some extra help of how to set up custom query filters and nav classes there's a link in the description below to a video where we go over that but for now we're going to move on to the other Dynamic nav mesh option which was fully Dynamic so we'll actually do that in the next video so I'll see you guys over there
Info
Channel: GamingDev2020
Views: 2,443
Rating: undefined out of 5
Keywords: Unreal Engine, Blueprints, NavModifier Volume, Fix NavMesh, Area Classes, NavAreaClasses, NavAreaClass, NavQueryFilter, NavigationQueryFilter, Pawns, NPC, Classes, Filters, NavMesh, Nav, Nav Mesh, NavMeshBoundsVolume, Nav Mesh Bounds Volume, Dynamic NavMesh, Dynamic Nav Mesh, Dynamic Nav Modifers
Id: 0AQzDuRtZnM
Channel Id: undefined
Length: 10min 1sec (601 seconds)
Published: Fri Sep 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.