====== Navigation Meshes ====== A navigation mesh is a joined set of polygons with geometric auxiliary data that informs an agent how to travel on the mesh. WORM is capable of automatically generating navigation meshes in the Goldsource engine. A user is able to export navigation meshes on the fly post-generation. ==== Generating a Mesh ==== There are multiple ways of generating a navigation mesh. === Method 1: Manual Seeding === - Enter the game level you wish to generate a navigation mesh for. - In each region, find an open space to place a coordinate seed via the command **worm addnode** - Once a coordinate seed has been placed in every region, execute the command **worm generate** - Wait for the mesh to generate. - If WORM Editor is set to interactive mode, execute **worm continue** until the process finishes. Otherwise, it will finish automatically. - The navigation mesh file will save to /addons/worm/data/nav/_#.sgd where # is an ID from 0-9 depending on what already exists. === Method 2: Automatic Seeding === - In order to perform automatic seeding, ensure that **Autoseed** is set to **true** in the [[configuration|configuration]]. - Simply execute **worm generate** after entering a level. - Wait for the mesh to generate. - If WORM Editor is set to interactive mode, execute **worm continue** until the process finishes. Otherwise, it will finish automatically. ==== Editing the Mesh ==== Once the automatic generation process is completed, use **worm load_spl #** to load the mesh into the level, where # is the file ID . To unload the mesh, use **worm unload_mesh**. In order to manually create a polygon, use **worm addpoint** to set the polygon's vertices, **worm createpoly** to create the polygon, and **worm graft** to append the element to the mesh. You can also force connections in this way. Use **worm addpoint** to create the boundary determined by exactly two points. Then use **worm select_node** to select the target node. Go within the interior of the source polygon and execute **worm forceconnect**. If you are not satisfied with the result, you can use **worm remove_connection** to remove the connection to the target node. After you are satisfied with your changes, you can use **worm save_spl #** to save the mesh as the desired ID. ==== Exporting Data ==== There are different ways of exporting data depending on the user's needs. See [[exporting_meshes|Exporting Meshes]] for more information. If you require the navigation mesh, then use the command **worm export_mesh** in order to save it in JSON format. Otherwise, you can use **worm export_polys_raw** to export only the mesh itself. In order to export shortest paths, execute **worm export_paths**.