NavLink Proxy And Smart Links; UNREAL ENGINE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this video we're going to be working with nav link proxies and we're going to start off with the basics we're going to control the flow of traffic through these three doors so we're going to have this as an exit door an entrance door and then we're going to use the middle door to kind of demonstrate how we do that so let's go ahead and see it in action first if he wants to come out of the building he's got to use the exit door if he wants to go back in he's got to choose the entrance Door so now let's go ahead and jump into the editor and we'll see how we do that and we'll test it out here in the middle door okay so here in the editor we can see that we have a nav mesh on both sides of the wall and they're connected by these green lines and these green lines are called nav link proxies and each link points in a specific Direction so for example this link was pointed from this side of the nav mesh to that side and this link was pointed from this nav mesh to that one and that's how we were creating the entrance and exit doors so now let's use the middle door we'll create a new nav link and we'll have it be two-way traffic so to do that we're going to go over here to place actor and we're going to search for nav link now we're going to choose this one here so when you first start out you're not going to have this blueprint we're going to create that later on you're going to choose this one and just go ahead and drag it in in front of a door and we just want to take one of the nodes here and we want to extend it to the other nav mesh so these nodes have to be touching a nav mesh in order for this to work and if we look at this text here we can see that this is the left node and this is the right node so now if we come over to the details panel if we look under simple link and we scroll down and we see direction we can make it left to right right to left or in this case we're going to make it Point both ways and let's go ahead and check out what that looks like we'll start with the first store we'll see if he can come out and if you can go back in then we'll come over to this store this was the exit door he can come out it but he can't go back in he has to choose a different door and this was the entrance Door we'll see if he can come out which he can he'll have to choose a different door but he can still go in it okay so that's how we can go ahead and control the flow of traffic through these three doors now we'll move on and see some other stuff that we can do with these nav links okay so here in this example we want the character to jump down from this ledge to the lower level so it's a quick and easy thing we're just going to go back into the editor and we'll come over here and again we just pull in an Appling proxy and we just want to align it with the nav mesh and then we'll take one of the nodes and we'll drag it across and we'll lower it down to the nav mesh and let's go ahead and see that in action so we'll come down here and now the character is able to jump down to the lower level okay in the next section we'll move on to jumping up to a higher ledge and in this example here we want the character to jump from a lower level up to a higher level so to do that we need to create something called a smart nav link so let's exit out of the game and we'll go down to the content browser and we'll make a new blueprint class and we'll search for nav link and it'll be this first one here we'll go ahead and create it and let's give it a name and then let's go ahead and open it and the first thing we're going to want to do is delete all of these now before we make our function let's go ahead and create some variables that we'll need so we'll make the first one and we're going to make it a character type and we'll use object reference character and I'm just going to rename this jump character and then let's create another one and we'll make this new one a float and I'm going to name this jump r and I'm going to make it instance editable and then let's go ahead and copy and paste this two more times and this first one is going to be base mod and the second one is going to be special mod now really quick let's talk about what these are the character is going to be the character who's doing the jump it's going to be a reference to him and then the jump Arc that's going to be a float that we're going to use to influence the uh the trajectory of the jump itself whether we want it to be more vertical or horizontal the base mod that's going to be a hidden value that you're going to use to kind of tweak the velocity output that's calculated and sometimes you'll need to do that if you're trying to have it jump at a weird angle or jump over an obstacle you're going to need to kind of add a little bit of a hidden modifier to what the function calculated on its own and then special mod is something that the player can influence themselves so for instance if they pick up a power up or some sort of jet pack or booster or something like that then you can add more power to the jump through this variable it can be a positive variable like a like a power up or it can be a negative amount like for instance if the character is over encumbered maybe you want to reduce his jumping power so you can have as many of these as you need and we're just going to use one for this video now let's go ahead and start the actual function the first node that we want to add we're going to search for event receive and we'll choose this one right here event receive smart link reached this is when a character whether it's your player character or an AI character this is when they reach the nav link and they want to initiate a jump from one side to the other so we'll set our character reference off of this agent parameter now we can't go directly from the agent parameter to the character reference because this is an actor reference and that's a character reference so we'll come down here and we'll go cast to character and we'll convert this to a purecast and now we can go ahead and plug it in and after we set that character reference we want to do a velocity calculation so we'll type in suggest and we'll see this one here suggest projectile velocity custom Arc so that's basically just saying it's going to calculate a velocity Arc between point a and point B so point a is going to be where the the character is standing so we'll do get actor location and we'll plug that into the start position and the end position is just the destination of the jump so we'll go ahead and bring that across and after we've done that we want to reveal these other parameters here we're not too interested in overriding the gravity but we are interested in Arc parameter and it says in the tool tip change height of Arc between 0 and 1 where 0.5 is the default medium Arc zero is more vertical and one is more horizontal so we want to be able to manipulate this value during the game so we'll bring in this variable that we created earlier and we'll plug it in and we'll set the default value as the tooltip suggested at 0.5 and we'll go ahead and compile and Save and then after that we want to bring out a delay node and this delay node is really just going to be a placeholder for now it's kind of used so that the velocity calculation has time to make sure that the character is actually on the starting position and it's also you can use it if you're going to do some custom animation where maybe the character will Crouch and bend his knees before he jumps you can replace this delay node later with an event dispatcher from your animation but we'll just stay with this for now and after all of this calculation we want to get the character and we we want them to actually perform the jump so we'll use the launch command for that launch character and let's go ahead and hook all this up and we want to override the X Y and Z because those are the directions he's going to be launched in and the launch velocity is what was calculated over here but before we plug it in we want to modify this value so we'll go multiply by a float and the the float that we want to multiply by it's going to be the combined value of all of our mods now we're only using two in this video but you might have more so we'll bring in the first one and we'll say get and then we'll do add float plus flow and again if you need more pins you can click that button there but I'm just going to use I'm just going to use the the two that we have and I'll bring in the other mod that we made and I'll plug it in there and so the combined value of all these mods that's what's going to multiply against the calculated velocity and that new velocity that's what's going to actually launch the player so now let's talk about these two mods real quick again as I mentioned before the the base mod is just a hidden value that you can use to tweak this calculation here if you need to get it to go a little higher or lower so we'll just put it to default as one because anything times 1 is just itself so by default it's not going to have any effect you would need to manually come in here and start adjusting it during your testing phase and then the special mod that's going to be default zero because it's not going to apply unless the character actually does something during the game like they pick up a power up or again if their inventory is over encumbered and they can only jump half as high so that that value will be manipulated at runtime so other than that that's the entire function and we're ready to compile and save and let's go ahead and check it out in game okay we'll come back here and we'll pull in our new smart link and we'll align it on the nav mesh and then once we have it aligned we need to come over here to the details panel and this time under smart link we're going to hit copy endpoints from some simple link to Smart link and then we're going to come down here and Check Smart link is relevant and then let's go ahead and save it and try it in game and let's test out the smart link that we just placed all right good he's able to jump up he's also able to jump back down it so if we want to control the flow of traffic on a smart link what we need to do is go back to the editor and under smart link we see the option to place the link Direction but that's not going to work because what you're doing is you're copying from the simple link and you see it it goes back to both ways again so what we do is we come up here to the simple link and we place the direction here let's say left to right now when we copy from at the Smart link now it will retain that that setting so now we can go ahead and try that out he's still able to jump left to right which in this case is jumping up but he's no longer able to jump down that one because we disabled right to left okay I'm going to go back and put it to both ways again so I come back up to simple link and I'll put it to both ways and then down here in smart link it's still at left to right but I'll hit copy and now it's set to both ways so let's go ahead and see if that worked so he'll be able to jump up and he'll be able to jump back down okay let's go ahead and move on and see some other things that we can do with smart links okay and in this example we want the character to make a horizontal jump over this trench so let's go ahead and see him do that first okay and now one thing we want to look at is if we go back into the editor the arch kind of comes up into the air like this and on a small jump like this it may not make that much of a difference but let's say you wanted to see him kind of jump on a flatter trajectory since this is a sort of a horizontal jump then what we're going to do is we're going to come down to this jump Arc parameter that we set and if we remember the tooltip it said the closer to one we set it the more horizontal the jump will be well I've already kind of uh tested it out so I know what setting I want to put it at um I'm just going to bump it up to 0.6 now because this is a small jump I don't have to bump it up that much but if it was a larger jump you'd probably have to choose a larger value but let's go ahead and see what that looks like okay and we see that he had a much a lower jump and it was much more horizontal rather than arcing up into the air so again on a small jump like this uh visually it may not make that much of a difference but that'll come in handy when you have larger jumps now let's go ahead and move on to another example okay so in this example we want to see the character perform a vertical jump to get to this top ledge so let's go ahead and see how that looks okay now let's go back into the editor and see how we do that so here in the editor we can see the arch of the nav links that we place down and if you notice we place them in a narrow tall fashion instead of pulling this one back and then having a gradual Arc all the way up and this is because we wanted to create sort of a trampoline effect where the character is propelled straight up and then lands on the top ledge now one thing we need to pay attention to is that we set the jump Arc parameter down to 0.25 to match this narrow Arc if we didn't do that we'll put it back to the default 0.5 then the calculation would be expecting the more gradual Arc and let's go ahead and take a look at what happens if we forget to update that value we'll go to play and then we'll try to make the jump and he's going to gradually Arc right into the side of the wall so what we want to do is go back to our editor and we'll put this down to 0.25 and let's try that again and this time it's going to calculate along a more vertical path and so that's how we're going to create that trampoline effect and get to the top ledge now before we move on there's one more thing we want to look at so we're going to go back to the editor and we'll just come down to the jump base mod and we're going to lower it to 0.75 and this will make the character too weak to make the jump so what they're going to have to do is come over to this blue flag which is surrounded by a sphere collision and they're going to collect a power up and that's going to feed into the jump special mod and it's going to put the 0.25 back which will allow them to complete the jump so let's head on over into the blueprint and set up the special mod okay here in the blueprint I just quickly have an on actor begin overlap for that sphere collision and when the character overlaps it it's just going to get the blue jump and it's going to take its jump special jump parameter and it's going to increase it by 0.25 and then it'll print it out so that we know it's working so let's go ahead and check it out in game so first we'll have them try and complete the blue jump without the power up and of course he's going to be too weak to do it now let's go get the power up and we'll come back and we'll try to do the jump again and this time he'll be strong enough to complete it okay let's head on to another example okay and for this last example we're going to collect two power-ups the first one will be for the blue jump which we already did and the second one will be for the red jump which is on this ledge here we'll collect the power up and jump to the final ledge and complete the level all right let's go into the editor and see how we do that so here in the editor we have the blue jump and the blue Power up which we already set up in the previous example and we're going to add in the red jump and the red Power UP And since the power ups are instance editable they're only going to affect the jump that we assign them to now we're also going to change the red Power up to where we have to collect it twice this is kind of like simulating in your game there being multiple power-ups scattered throughout your level and being guarded by different Boss characters but here in this video we're going to save time and just collect the same one twice so let's open up the level blueprint and see how to do that okay and here on my level blueprint I have my on actor begin overlap for my blue sphere Collision which we already saw and then I have an identical one for the red sphere Collision I also had already set the red jump down to 0.70 on the base mod value which means that the special mod value is going to need a total of 0.30 for him to be strong enough to complete that jump but we wanted him to touch it twice so I'm going to lower this down to 0.15 and then we'll go ahead and check it out in game okay so we know that we have to come down here and collect the blue Power Up and we should make it past the blue jump no problem but now let's collect one of the red power ups and see if we're strong enough to get across and we almost made it but not quite so now we'll go back across and try again and now we'll collect the second power up and now he should be strong enough to get to the final ledge and finish the level all right that should be everything you need to get started with nav link proxies I hope this video helped please like And subscribe and I'll see you guys in another video
Info
Channel: GamingDev2020
Views: 1,492
Rating: undefined out of 5
Keywords: Unreal Engine, Blueprints, NavModifier Volume, NavLink Proxy, Nav Link Proxy, Fix NavMesh, Bald Spot In NavMesh, SmartLinks, Ledges, Jumping, Proxies, Nav Proxies, Smart Links, Smart Nav Links, SmartNavLinks, Horizontal Jump, Vertical Jump, Jump Arc, Velocity, Launch Character, Trampoline Effect
Id: iu7cjp1Gg7U
Channel Id: undefined
Length: 19min 18sec (1158 seconds)
Published: Thu Sep 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.