Godot Navigation Lite Addon Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome together navigation light add-on tutorial so what does this I don't do it allows user to change the navigation mesh in real time by adding obstacles bridges and similar objects which gato currently lacks it also allows user to have multiple different navigation meshes for different units in the game the main feature of this add-on is that it's easy to use which I will show in practice by changing the default navigation in a project I'm currently working on so this is my current project and it's using default gutter navigation with navigation node and the navigation mesh the navigation mesh in default Godot navigation is created from static objects or mesh instances I'll run the scene with default navigation in my case units sometimes don't find the optimal path to the target which was also my primary motivation for creating geodon so let's get back to the add-on it is written in C++ so performance should not be an issue and it uses detour library which is also used by Unreal Engine and unity it currently supports creating navigation meshes from static bodies so let's install the add-on you can do so by visiting github page of this add-on which contains the link to download once you downloaded it open it and we also want to open your projects root folder as you want to copy the add-on to your add-ons folder we can do so by choosing open and File Manager in your filesystem tab you want to copy the god of navigation light from the add-ons folder to your projects add-ons folder if you don't have it just created you once it's copied we have to get project and enable the add-on by selecting project settings and choosing plugins there you have to change the state to active next we have to set up our notes first we'll choose the base navigation note and we want to change its type to detour navigation once it's set we also want to change the navigation mesh node to the spatial since we don't need the Gerdes navigation mesh functionalities anymore now it's time to create our navigation mesh we choose the detour navigation node and select navigation manager to create navigation mesh it will create a new node with a lot of properties we also have to bake it like we do in default code or navigation mesh you can see that it recognized the terrain mesh but did not recognize trees or buildings because I have them a second third bit of collision mask we have to change the collision mask to include them and we have to bake it again now with our desired result last thing we have to change is replace get simple path method with find path function call I have it commented here it is very similar and we have to call find pet function on navigation mesh node provided the start and end position and select the points array from the results dictionary you you set and we can started the scene the navigation mesh is styled as you can see which helps with performance if you make a change on it it will update only the effect styles and not the whole mesh find path function is also working as expected and the units are successfully avoiding the obstacles I want to show you some real-time changes I'll remove a house from the navigation mesh I'll do so in editor and it will reflect also in game if we switch back you can see that the obstacle of the house has disappeared and if I return it back the changes will automatically reflect on the navigation mesh so basic navigation mesh allows us to add and remove static bodies to or from the mesh if you want to toggle navigation mesh visibility just check it off in the debug menu so that is basic feature set but there is more the add-on also supports cache to navigation meshes they're useful if you need very fast navigation mesh changes by adding obstacles so I'll make the house in my case to be in dynamic domain dynamic objects will be added much faster but they will have fewer restrictions only box and cinder shapes are supported and they just subtract areas from navigation mesh so we can't use them for example bridges they're useful for doors or slowly moving big structures if I want to create a navigation mesh for vehicles I can increase the agent radius and have one navigation mesh for infantry and one for vehicles I'll bake it and as you can see the buildings aren't included in the baking process anymore that's because dynamic obstacle surrett is during the runtime the padding around the trees is also wider because we increased the agents radius we've also had to change the find path function to use our newly created cached navigation mesh instead of the previous one to be able to demonstrate the real-time changes I've changed my building placing logic to manually call the add cash division function if the static objects collision layer is inside the navigation mesh collision mask it will be automatically added but since my static objects does not have the right collision layer when it's created and I change it when it's placed I have to manually call it okay so let's start the scene and check how it works the house is now are set as dynamic obstacles but it's just for testing purposes so and I decided to place the building our manual function gets called and updates the navigation mesh in majority of cases you don't have to call the manual function it's only necessary if the added static body does not have the same collision bit set as your navigation mesh units are avoiding houses like this should since I can't use dynamic obstacles for objects like bridges I'll set them to be in regular collision domain first I'll change the manual call to place the regular collision shape instead of cached and after that I'll change the collision masks so the buildings are regular collision objects again you I've changed back the agents parameters and I also want to increase the maximum climb a bit since my meshes aren't synced with terrain well you you so now we can start the scene and see the results you should try to have a simple collision of shapes as you can if you want to good performance for example for a house you can add a box for the base and rotating box for the roof and you can also add boxes for trees so basically box shapes are the fastest since they require the least number of polygons for complex objects like my bridge for instance you have no other option but to use convex or concave collision shapes and in dynamic obstacles option you can also use cylinders and there will be as fast as boxes for more information check the github page you can find documentation there as well as a demo project if you have any issues you're welcome to post them on github the add-on is currently available for Linux and Windows but it should be released for other platforms as well if you need advanced features you can post feature requests but you should first check out the gutter detour add-on created by the sheep with Rupali on github as it has some fancy detour features implemented all the links are in the description thank you for watching and good bye
Info
Channel: Miloš Lukić
Views: 4,299
Rating: undefined out of 5
Keywords:
Id: rWFgo6M--Dc
Channel Id: undefined
Length: 8min 46sec (526 seconds)
Published: Wed Apr 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.